I got two of the same errors , I trying to make my enemy ai follow the player . I capitalize the t on transform and I get more errors here is my code :
using UnityEngine;
using System.Collections;
public class Enemyai : MonoBehaviour {
public Transform player;
static Animator anim;
void Start ()
{
anim = GetComponent ();
}
void Update ()
{
if (Vector3.Distance(player.position, this.transform) < 10)
{
Vector3 direction = player.position - this.transform.position;
direction.y = 0;
this.transform.rotation = Quaternion.Slerp (this.transform.rotation,Quaternion.LookRotation(direction), 0.1f);
}
}
}
↧