Enable/Disable the NavmeshAgent programatically?

Is there a way to uncheck the Navmesh Agent check box programatically? Can it be done using a NavMeshAgent object?

37044-enable.png

Change to:

[37045-^cdba32e2c5ae2ed507d9b1a11137b27d26c5ce0885a628c92b^pimgpsh_fullsize_distr.jpg|37045]

Not go access to Unity at the moment but if the script is attached to the character you want to disable a component on then in c#

gameObject.GetComponent<NaveMeshAgent>().enabled = false;

JS

gameObject.GetComponent(NavMeshAgent).enabled = false;

if the script isn’t on the character the you need to reference the gameObject it’s on with Find or FindGameObjectWithTag.

The above should work just replace gameObject with whatever variable use store the result of the Find.

Like I said not got access to Unity so sorry for any typo’s!

agent.enabled = !agent.enabled

!agent.enabled its not disabling agent always, some other function can activate this again (possible agent.isStopped =false or warp)
i think better stop updating agent (agent.updatePos = fasle, rotation = false and axis)

Go to a flat part of the map. Doesn’t matter if you are on a slope as long as it’s flat. Then, press ~ to open the console. Then, type in the console nav_mark_walkable then nav_generate