- 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