namespace RPG.Control
{
public class AIController : MonoBehaviour
{
[SerializeField] float chaseDistance = 1f;
private void Update()
{
if (DistanceToPlayer() < chaseDistance)
{
print(gameObject.name + "Should chase");
}
}
private float DistanceToPlayer()
{
GameObject player = GameObject.FindWithTag("Player");
return Vector3.Distance(player.transform.position, transform.position);
}
}
}
this is my AIController, unsure why this isn’t working as it is in the lecture. Any suggestions?