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

MagicTimm

Member
Hi, after a few seconds this error message appears.

Maybe the problem is the A* ?

public override void OnStart()
{
navMeshAgent.enabled = true;

// use the position if it is not zero
if (targetPosition.Value != Vector3.zero) {
staticPosition = true;
navMeshAgent.destination = targetPosition.Value; <----------- error
}

// set the destination if it hasn't already been set with a static position
if (staticPosition == false) {
navMeshAgent.destination = target.Value.position; <----------- error
}
}
 
The RTS sample scene isn't setup to work with A*. If you want to use A* you'll need to swap out the tasks for an A* task.
 
Top