- Home /
Question by
RegionGames · Apr 28, 2020 at 01:43 PM ·
navmeshagentpathfinding
NPC agent doesn't move
Hi everyone.
So i'm creating a really simple NPC that will walk to a destnation. Only problem is that my script doesn't work and the NPC just walks in place. Here is the code. I am using 'UnityEgine.AI' btw.
public class NPCAI : MonoBehaviour {
public GameObject destinationPoint;
NavMeshAgent theAgent;
// Start is called before the first frame update
void Start()
{
theAgent = GetComponent<NavMeshAgent>();
}
// Update is called once per frame
void Update()
{
theAgent.SetDestination(destinationPoint.transform.position);
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612232608im_/https://answers.unity.com/themes/thub/images/avi.jpg)