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?

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;