Nav3DInitializer
To use Nav3D in playmode, you need to initialize it.
The Nav3DInitializer component is designed for this. Create it on the scene using the following top menu button:
The following game object will appear on the scene:
- Init On Awake – Leave this flag enabled to initialize Nav3D in the playmode on Awake event invocation.
- Dispose On Destroy – Leave this flag enabled to force Nav3D to clean up all of its internal entities when destroying scene. If disabled, Nav3D and its entities will continue to work when a new scene is loaded.
- Min Bucket Size – the minimum size of the navigation graph buckets. Must be a positive non-zero number. Here we will explain in a little more detail.Essentially, this parameter allows you to customize the level of detail of the navigation graph. The smaller the parameter value, the higher the detail of the graph.
All game agents that will search for a path using Nav3D have their own size, determined by the radius that you give them when creating. (We will explain this a little later). The minimum cell size must be equal to the maximum radius of the agents, this will guarantee that the agent can go along any path in the graph. If there are agents on the scene whose radius exceeds the minimum bucket size of the navigation graph, then situations are possible when the agents collide obstacles on the stage. Future versions of Nav3D will implement agent size-dependent pathfinding.
*If the Init On Awake and Dispose On Destroy options are disabled, it will be your responsibility to initialize and dispose Nav3D resources. For initialization you will need to call the Nav3DInitializer.Init() method, for disposal – Nav3DInitializer.Utilize(). The value of the Min Bucket Size parameter can also be set via code; to do this, use the MinBucketSize property.