I followed the tutorial for Survival Shooter until the 4th video.
However, the enemy just walks to (0,0,0) and then keeps walking on the spot.
I printed out the x and y axis in PlayerMovement.cs.
playerRigidbody.MovePosition (transform.position + movement);
It prints out the new position of my player but when it prints player.position in EnemyMovement.cs (as below), it’s always (0,0,0).
Anyone has any clue on what might have caused this issue?
EnemyMovement.cs:
void Awake ()
{
player = GameObject.FindGameObjectWithTag("Player").transform;
nav = GetComponent <NavMeshAgent> ();
}
void Update ()
{
nav.SetDestination(player.position);
Debug.Log (player.position);
}