Help? I’m trying to create basic AI to follow the player around, keep getting this ‘error’ and the Enemy Tank never moves? Here is a link to my code for the EnemyMovement Class
1 Answer
1The console will tell you which line the error is occurring on. Whichever object you’re referencing there hasn’t been set.
Looking at your code (which you should post directly using the “101010” button) my guess is that you should change
player = GameObject.FindGameObjectWithTag ("Player").transform;
to
player = GameObject.FindWithTag("Player").transform;
And in Awake(), change
NavMeshAgent agent = GetComponent<NavMeshAgent> ();
to
agent = GetComponent<NavMeshAgent>();
What do you mean I should post directly using the "101010" button? And let me try that real quick. And it is on line 29 of the file.
– ltrout1999
Could you help @Soraphis?
– ltrout1999