settings.colliderRasterizeDetail=EditorGUILayout.Slider(newGUIContent("Round Collider Detail","Controls the detail of the generated sphere and capsule meshes. "+
"Higher values may increase navmesh quality slightly, and lower values improve graph scanning performance."),Mathf.Round(10*settings.colliderRasterizeDetail)*0.1f,0,1.0f/LowestApproximationError);
settings.rasterizeTerrain=EditorGUILayout.Toggle(newGUIContent("Rasterize Terrains","Should a rasterized terrain be included"),settings.rasterizeTerrain);
if(settings.rasterizeTerrain){
EditorGUI.indentLevel++;
settings.rasterizeTrees=EditorGUILayout.Toggle(newGUIContent("Rasterize Trees","Rasterize tree colliders on terrains. "+
"If the tree prefab has a collider, that collider will be rasterized. "+
"Otherwise a simple box collider will be used and the script will "+
"try to adjust it to the tree's scale, it might not do a very good job though so "+
"an attached collider is preferable."),settings.rasterizeTrees);
settings.terrainHeightmapDownsamplingFactor=EditorGUILayout.IntField(newGUIContent("Heightmap Downsampling","How much to downsample the terrain's heightmap. A lower value is better, but slower to scan"),settings.terrainHeightmapDownsamplingFactor);
settings.rasterizeMeshes=EditorGUILayout.Toggle(newGUIContent("Rasterize Meshes","Should meshes be rasterized and used for building the navmesh"),settings.rasterizeMeshes);
settings.rasterizeColliders=EditorGUILayout.Toggle(newGUIContent("Rasterize Colliders","Should colliders be rasterized and used for building the navmesh"),settings.rasterizeColliders);
}else{
// Colliders are always rasterized in 2D mode
EditorGUI.BeginDisabledGroup(true);
EditorGUILayout.Toggle(newGUIContent("Rasterize Colliders","Should colliders be rasterized and used for building the navmesh. In 2D mode, this is always enabled."),true);
EditorGUILayout.HelpBox("You are rasterizing both meshes and colliders. This is likely just duplicate work if the colliders and meshes are similar in shape. You can use the RecastNavmeshModifier component"+
" to always include some specific objects regardless of what the above settings are set to.",MessageType.Info);
graph.dimensionMode=(RecastGraph.DimensionMode)EditorGUILayout.Popup(newGUIContent("Dimensions","Should the graph be for a 2D or 3D world?"),(int)graph.dimensionMode,DimensionModeLabels);
// In 3D mode, we use the graph's center as the pivot point, but in 2D mode, we use the center of the base plane of the graph as the pivot point.
// This makes sense because in 2D mode, you typically want to set the base plane's center to Z=0, and you don't care much about the height of the graph.
GUILayout.Label("Warning: Might take some time to calculate",helpBox);
GUI.color=preColor;
}
if(!editor.isPrefab){
if(GUILayout.Button(newGUIContent("Snap bounds to scene","Will snap the bounds of the graph to exactly contain all meshes in the scene that matches the masks."))){
graph.characterRadius=EditorGUILayout.FloatField(newGUIContent("Character Radius","Radius of the character. It's good to add some margin.\nIn world units."),graph.characterRadius);
EditorGUILayout.HelpBox("For best navmesh quality, it is recommended to keep the character radius at least 2 times as large as the voxel size. Smaller voxels will give you higher quality navmeshes, but it will take more time to scan the graph.",MessageType.Warning);
graph.walkableHeight=EditorGUILayout.DelayedFloatField(newGUIContent("Character Height","Minimum distance to the roof for an area to be walkable"),graph.walkableHeight);
graph.maxEdgeLength=EditorGUILayout.FloatField(newGUIContent("Max Border Edge Length","Maximum length of one border edge in the completed navmesh before it is split. A lower value can often yield better quality graphs, but don't use so low values so that you get a lot of thin triangles."),graph.maxEdgeLength);
// This is actually a float, but to make things easier for the user, we only allow picking integers. Small changes don't matter that much anyway.
graph.contourMaxError=EditorGUILayout.IntSlider(newGUIContent("Edge Simplification","Simplifies the edges of the navmesh such that it is no more than this number of voxels away from the true value.\nIn voxels."),Mathf.RoundToInt(graph.contourMaxError),0,5);
graph.minRegionSize=EditorGUILayout.FloatField(newGUIContent("Min Region Size","Small regions will be removed. In voxels. Only regions within single tiles can be removed. Regions that span multiple tiles will always be kept. If you don't use tiling, then all small regions will be removed."),graph.minRegionSize);
GUILayout.Label(graph.meshesUnreadableAtRuntime.Count+" "+(graph.meshesUnreadableAtRuntime.Count>1?"meshes":"mesh")+" will be ignored if scanned in a standalone build, because they are marked as not readable."+
"If you plan to scan the graph in a standalone build, all included meshes must be marked as read/write in their import settings.",EditorStyles.wordWrappedMiniLabel);
graph.enableNavmeshCutting=EditorGUILayout.Toggle(newGUIContent("Affected by Navmesh Cuts","Makes this graph affected by NavmeshCut and NavmeshAdd components. See the documentation for more info."),graph.enableNavmeshCutting);
Separator();
Header("Debug");
GUILayout.BeginHorizontal();
GUILayout.Space(18);
graph.showMeshSurface=GUILayout.Toggle(graph.showMeshSurface,newGUIContent("Show surface","Toggles gizmos for drawing the surface of the mesh"),EditorStyles.miniButtonLeft);
graph.showMeshOutline=GUILayout.Toggle(graph.showMeshOutline,newGUIContent("Show outline","Toggles gizmos for drawing an outline of the nodes"),EditorStyles.miniButtonMid);
graph.showNodeConnections=GUILayout.Toggle(graph.showNodeConnections,newGUIContent("Show connections","Toggles gizmos for drawing node connections"),EditorStyles.miniButtonRight);
"Require every region to have a RelevantGraphSurface component inside it.\n"+
"A RelevantGraphSurface component placed in the scene specifies that\n"+
"the navmesh region it is inside should be included in the navmesh.\n\n"+
"If this is set to OnlyForCompletelyInsideTile\n"+
"a navmesh region is included in the navmesh if it\n"+
"has a RelevantGraphSurface inside it, or if it\n"+
"is adjacent to a tile border. This can leave some small regions\n"+
"which you didn't want to have included because they are adjacent\n"+
"to tile borders, but it removes the need to place a component\n"+
"in every single tile, which can be tedious (see below).\n\n"+
"If this is set to RequireForAll\n"+
"a navmesh region is included only if it has a RelevantGraphSurface\n"+
"inside it. Note that even though the navmesh\n"+
"looks continous between tiles, the tiles are computed individually\n"+
"and therefore you need a RelevantGraphSurface component for each\n"+
"region and for each tile."),
graph.relevantGraphSurfaceMode);
#pragmawarningdisable618
if(graph.nearestSearchOnlyXZ){
graph.nearestSearchOnlyXZ=EditorGUILayout.Toggle(newGUIContent("Nearest node queries in XZ space",
"Recomended for single-layered environments.\nFaster but can be inacurate esp. in multilayered contexts."),graph.nearestSearchOnlyXZ);
EditorGUILayout.HelpBox("The global toggle for node queries in XZ space has been deprecated. Use the NNConstraint settings instead.",MessageType.Warning);