graph.editorTileSize=EditorGUILayout.IntField(newGUIContent("Tile Size","Size in voxels of a single tile.\n"+
"This is the width of the tile.\n"+
"\n"+
"A large tile size can be faster to initially scan (but beware of out of memory issues if you try with a too large tile size in a large world)\n"+
"smaller tile sizes are (much) faster to update.\n"+
"\n"+
"Different tile sizes can affect the quality of paths. It is often good to split up huge open areas into several tiles for\n"+
"better quality paths, but too small tiles can lead to effects looking like invisible obstacles."),graph.editorTileSize);
EditorGUI.indentLevel--;
}
graph.minRegionSize=EditorGUILayout.FloatField(newGUIContent("Min Region Size","Small regions will be removed. In square world units"),graph.minRegionSize);
graph.walkableHeight=EditorGUILayout.DelayedFloatField(newGUIContent("Walkable Height","Minimum distance to the roof for an area to be walkable"),graph.walkableHeight);
graph.walkableClimb=EditorGUILayout.FloatField(newGUIContent("Walkable Climb","How high can the character climb"),graph.walkableClimb);
// A walkableClimb higher than this can cause issues when generating the navmesh since then it can in some cases
// Both be valid for a character to walk under an obstacle and climb up on top of it (and that cannot be handled with a navmesh without links)
if(graph.walkableClimb>=graph.walkableHeight){
graph.walkableClimb=graph.walkableHeight;
EditorGUILayout.HelpBox("Walkable climb should be less than walkable height. Clamping to "+graph.walkableHeight+".",MessageType.Warning);
}elseif(graph.walkableClimb<0){
graph.walkableClimb=0;
}
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 cell size. Smaller cell sizes will give you higher quality navmeshes, but it will take more time to scan the graph.",MessageType.Warning);
}
graph.maxSlope=EditorGUILayout.Slider(newGUIContent("Max Slope","Approximate maximum slope"),graph.maxSlope,0F,90F);
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);
graph.contourMaxError=EditorGUILayout.FloatField(newGUIContent("Max Edge Error","Amount of simplification to apply to edges.\nIn world units."),graph.contourMaxError);
graph.rasterizeTerrain=EditorGUILayout.Toggle(newGUIContent("Rasterize Terrain","Should a rasterized terrain be included"),graph.rasterizeTerrain);
if(graph.rasterizeTerrain){
EditorGUI.indentLevel++;
graph.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."),graph.rasterizeTrees);
if(graph.rasterizeTrees){
EditorGUI.indentLevel++;
graph.colliderRasterizeDetail=EditorGUILayout.FloatField(newGUIContent("Collider Detail","Controls the detail of the generated collider meshes. "+
"Increasing does not necessarily yield better navmeshes, but lowering will speed up scan.\n"+
"Spheres and capsule colliders will be converted to meshes in order to be able to rasterize them, a higher value will increase the number of triangles in those meshes."),graph.colliderRasterizeDetail);
EditorGUI.indentLevel--;
}
graph.terrainSampleSize=EditorGUILayout.IntField(newGUIContent("Terrain Sample Size","Size of terrain samples. A lower value is better, but slower"),graph.terrainSampleSize);
graph.terrainSampleSize=graph.terrainSampleSize<1?1:graph.terrainSampleSize;//Clamp to at least 1
EditorGUI.indentLevel--;
}
graph.rasterizeMeshes=EditorGUILayout.Toggle(newGUIContent("Rasterize Meshes","Should meshes be rasterized and used for building the navmesh"),graph.rasterizeMeshes);
graph.rasterizeColliders=EditorGUILayout.Toggle(newGUIContent("Rasterize Colliders","Should colliders be rasterized and used for building the navmesh"),graph.rasterizeColliders);
if(graph.rasterizeColliders){
EditorGUI.indentLevel++;
graph.colliderRasterizeDetail=EditorGUILayout.FloatField(newGUIContent("Collider Detail","Controls the detail of the generated collider meshes. "+
"Increasing does not necessarily yield better navmeshes, but lowering will speed up scan.\n"+
"Spheres and capsule colliders will be converted to meshes in order to be able to rasterize them, a higher value will increase the number of triangles in those meshes."),graph.colliderRasterizeDetail);
EditorGUILayout.HelpBox("You are rasterizing both meshes and colliders, this might just be duplicating the work that is done if the colliders and meshes are similar in shape. You can use the RecastMeshObj component"+
" to always include some specific objects regardless of what the above settings are set to.",MessageType.Info);
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.SnapForceBoundsToScene();
GUI.changed=true;
}
Separator();
EditorGUILayout.HelpBox("Objects contained in any of these masks will be rasterized",MessageType.None);
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();
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);
EditorGUILayout.HelpBox("Nearest node queries in XZ space is not recommended for rotated graphs since XZ space no longer corresponds to the ground plane",MessageType.Warning);
}
}
/// <summary>Exports the INavmesh graph to a .obj file</summary>