Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
genii.393095's avatar
genii.393095
Honored Guest
9 months ago

"SetDestination" can only be called on an active agent that has been placed on a NavMesh Error

I am trying to build an AR game for the Quest 3. The Navmesh is baked on when the current room loads. I am attempting to spawn objects into my scene. 

I have two different objects that spawn. The first spawns fine. The second always create this error 

"SetDestination" can only be called on an active agent that has been placed on a NavMesh.
UnityEngine.AI.NavMeshAgent:SetDestination (UnityEngine.Vector3)
Ghost:Update () (at Assets/XR/Scripts/Ghost.cs:56)

My Ghosts are not spawning to valid positions. 

 

Line 56 in the Ghost.cs file is this

 agent.SetDestination(targetPosition);
 
Here is a link to the complete script
 

The intention is to have them spawn outside the wall of the current room. 

 

Replies have been turned off for this discussion