Creating NavMeshAgent types at runtime
So, I'm trying to create a new NavMeshAgent type at runtime (in 2017.1).
I know that new agent types can be created using something of the form,
NavMeshBuildSettings agentSettings = NavMesh.CreateSettings();
This creates a new agent type with its own unique agentTypeID (which I can access from the agentSettings object), which appears in the list of types in the NavMesh editor window. But then I can't figure out how to alter the attributes of this agent. NavMeshBuildSettings
is a struct
, not a class, and hence is passed by value, so any alterations I make to it are not carried through to the NavMesh
build settings. I can't find a method on the NavMesh
class which allows me to pass one of these structs back, only get them.
So, in short, my question is: How do I adjust the parameters of new (or any, for that matter) NavMesh agent types at runtime? I'm struggling to believe that it's possible to create a new agent type but not be able to edit it.
Any help you may collectively be able to provide is much appreciated. I feel certain I'm missing something obvious.
I'm also trying to do the same, create agent type at run-time, and it does not seem possible to use them (which I refuse to believe)!
Some more info: the only property of Nav$$anonymous$$eshSurface
that can be affected is agentTypeId
, but even if I set that to the ID of the newly created agent, nothing happens.
Did someone find out how to do this? Do I need to modify Nav$$anonymous$$eshSurface
for this to work?
upping this out because I'm also having huge issues base on this thread.
Your answer
Follow this Question
Related Questions
How do I make an animated AI enemy float but still move using NavMesh? 2 Answers
Animator scripting not working as expected, 0 Answers
Off Mesh Link - Limiting access to certain agents 2 Answers
unity nav mesh agent movement stutter 0 Answers
How to get AI to wander randomly around a point with NavMesh? 0 Answers