- Home /
Objects not updating if not selected in Hierarchy?
Hello,
I have two cubes that are used a NavMesh and NavAgent to move between four different way points. Anytime the cube enters one trigger, it will randomly select another way point from a list and move to that way point.
When running the game, if I have either cube selected, they both move around the way points just as I would expect. But, if I select something else in the hierarchy window (such as one of the way points), the cubes will stop moving entirely. I can leave it for a few minutes, they don't move, but then I select one of the cubes and they start moving again.
Here is the method I am using to select a new way point;
void OnTriggerEnter(Collider other)
{
if(other.tag == "Waypoint")
{
currentWaypoint = waypoints [Random.Range (0, waypoints.Count)];
}
}
The code works just as I would expect, so I am assuming this issue is something about the script not executing when the object is not selected. I have no way to debug this issue and I would greatly appreciate any insight! Thanks!
Your answer
Follow this Question
Related Questions
NavMeshAgent Not Accounting for Objects 0 Answers
Disable navmesh binding 1 Answer
Add Non-walkable obstacles on NavMesh at runtime 0 Answers
Procedural NavMesh Instantiating 0 Answers
Objects not updating at runtime if not selected in hierarchy? 0 Answers