Is there something wrong with NavMeshAgent?
Hey ppl,
i am new to Unity and i am learning it on my own, i have started working on a game app i want to do. in this project i want to use the NavMeshAgent to make the "npc" locate items near it and go to grab them, i do see the component on the gameobject but when im trying to reach it from a script i cannot create a variable with a type of NavMeshAgent its like there is no such thing.
do i need to import something or am i missing something? i have watched the tutorials and even tried 100% same code and it doesnt recognize NavMeshAgent.
example
if i will do :
public GameObject gameObject;
then we have created a variable called "gameObject" and is type of GameObject now if i want to create a NavMeshAgent such as :
public NavMeshAgent agent;
then it will not recognize "NavMeshAgent" and compiler says its an error.
what to do?
Answer by MaazBaig · Feb 08, 2017 at 08:27 PM
Yea i just had the same issue aswell.
Had to google around but found nothing.
Then thought Unity loves to put calls into libraries.... and i was right...
Put this on top:
using UnityEngine.AI;
Thanks for the answer mate, but i forgot about this thread completely.
any who i have finished my project already and everything works as i expected, anyway thanks again for your answer mate, at least this thread will help others if they will search for such answer like i did when i had trouble with it.
Your answer
Follow this Question
Related Questions
How to access variables in another scene? 2 Answers
Grouping variables question 1 Answer
Referencing variables in another script on the same game object 0 Answers
One script says the variable is 0 but the other says -37 1 Answer
Counting Activation of specific panels, not updating Variable? 2 Answers