Search Issue Tracker

By Design

Votes

0

Found in

5.6.5f1

Issue ID

1009558

Regression

No

NavMeshBuildSettings.voxelSize always return 0.1666667

AI Navigation

-

To reproduce:

1. Open the project, attached by the tester (NavMeshSettingsBug.zip)
2. Open the "test" scene
3. Enter Play mode
4. Observe console
5. Compare the result in the console with the result in Navigation window

Expected: NavMeshBuildSettings.voxelSize should return the value that is in the field in the Navigation window

Reproduced in 5.6.5f1, 2017.1.3p1, 2017.2.2p1, 2017.3.1p4, 2018.1.0b10, 2018.2.0a4

The behaviour is the expected one.
The settings shown in the Navigation window, tab "Bake", are only used when the "Bake" button is pressed and the NavMesh building process gets initiated. There is no method to retrieve their values.

The function `UnityEngine.AI.NavMesh.GetSettingsByIndex()` returns a copy of the NavMeshBuildSettings of a specific agent type from the list presented in the "Agents" tab of the Navigation window. Not all the settings are made visible there because not all of them are properties relevant for the agent. Those other properties that are not shown there will always have the same default value. They cannot be currently saved back into the settings store with different values. But the properties of the returned NavMeshBuildSettings object can be freely modified before the object is passed as a parameter to the method that builds the NavMesh (i.e. NavMeshBuilder.BuildNavMeshData, NavMeshBuilder.UpdateNavMeshData or NavMeshBuilder.UpdateNavMeshDataAsync). For example that is exactly how the settings are prepared before the NavMeshSurface component builds the NavMesh, as seen in this code here https://github.com/Unity-Technologies/NavMeshComponents/blob/5784c58c95fa7bd46a6cfb074cc42e9ecb48c211/Assets/NavMeshComponents/Scripts/NavMeshSurface.cs#L139 .

Another thing to mention is that there is currently no way of retrieving from a NavMesh the settings which were used when baking it.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.