- Home /
NavMesh Obstacle Problem
Dear: Reader
I am having troubles with the navmesh obstacle component attached to my turret, In my TD game. When I put a tower on the road to block the enemy so it can find a new path, it stops all my enemies from moving, but the enemies that get spawned afterwards find new paths and continue as desired. Is there a way to recalculate the navmesh agent on the enemies? like how A* Pathfinding asset has a "AstarPath.active.Scan ();" action? Or a different solution to my problem would be awsome!
James
Comment
Best Answer
Answer by jimjames · Jan 20, 2015 at 02:01 PM
What I was looking for was something like this:
public Transform target;
private NavMeshAgent agent;
void Start()
{
private NavMeshAgent agent;
}
void Update()
{
agent.destination = target.position; //moves agent"object" on the NavMesh towards the "target"
if(agent.isPathStale == true) //checks if the agents path got staled "a built in bool on the agent i believe"
{
agent.ResetPath(); //this is what i was looking for!!!
}
}
Answer by AngryBurritoCoder · Jan 19, 2015 at 11:23 PM
You cannot remake the nav mesh map at runtime, UNLESS you have Unity Pro