public void OnBecameInvisible() { if (this.m_BecameVisibleCalled) { NavMeshVisualizationSettings.showNavigation--; NavMeshEditorWindow.RepaintSceneAndGameViews(); this.m_BecameVisibleCalled = false; } }
public void OnBecameVisible() { if (NavMeshVisualizationSettings.showNavigation) { return; } NavMeshVisualizationSettings.showNavigation = true; NavMeshEditorWindow.RepaintSceneAndGameViews(); }
private static void DisplayControls(UnityEngine.Object target, SceneView sceneView) { EditorGUIUtility.labelWidth = 150f; bool flag = false; bool showNavMesh = NavMeshVisualizationSettings.showNavMesh; if (showNavMesh != EditorGUILayout.Toggle(EditorGUIUtility.TextContent("Show NavMesh"), showNavMesh, new GUILayoutOption[0])) { NavMeshVisualizationSettings.showNavMesh = !showNavMesh; flag = true; } EditorGUI.BeginDisabledGroup(!NavMeshVisualizationSettings.hasHeightMesh); bool showHeightMesh = NavMeshVisualizationSettings.showHeightMesh; if (showHeightMesh != EditorGUILayout.Toggle(EditorGUIUtility.TextContent("Show HeightMesh"), showHeightMesh, new GUILayoutOption[0])) { NavMeshVisualizationSettings.showHeightMesh = !showHeightMesh; flag = true; } EditorGUI.EndDisabledGroup(); if (Unsupported.IsDeveloperBuild()) { GUILayout.Label("Internal"); bool showNavMeshPortals = NavMeshVisualizationSettings.showNavMeshPortals; if (showNavMeshPortals != EditorGUILayout.Toggle(new GUIContent("Show NavMesh Portals"), showNavMeshPortals, new GUILayoutOption[0])) { NavMeshVisualizationSettings.showNavMeshPortals = !showNavMeshPortals; flag = true; } bool showNavMeshLinks = NavMeshVisualizationSettings.showNavMeshLinks; if (showNavMeshLinks != EditorGUILayout.Toggle(new GUIContent("Show NavMesh Links"), showNavMeshLinks, new GUILayoutOption[0])) { NavMeshVisualizationSettings.showNavMeshLinks = !showNavMeshLinks; flag = true; } bool showProximityGrid = NavMeshVisualizationSettings.showProximityGrid; if (showProximityGrid != EditorGUILayout.Toggle(new GUIContent("Show Proximity Grid"), showProximityGrid, new GUILayoutOption[0])) { NavMeshVisualizationSettings.showProximityGrid = !showProximityGrid; flag = true; } bool heightMeshBvTree = NavMeshVisualizationSettings.showHeightMeshBVTree; if (heightMeshBvTree != EditorGUILayout.Toggle(new GUIContent("Show HeightMesh BV-Tree"), heightMeshBvTree, new GUILayoutOption[0])) { NavMeshVisualizationSettings.showHeightMeshBVTree = !heightMeshBvTree; flag = true; } } if (!flag) { return; } NavMeshEditorWindow.RepaintSceneAndGameViews(); }
public void OnBecameVisible() { if (!this.m_BecameVisibleCalled) { bool flag = NavMeshVisualizationSettings.showNavigation == 0; NavMeshVisualizationSettings.showNavigation++; if (flag) { NavMeshEditorWindow.RepaintSceneAndGameViews(); } this.m_BecameVisibleCalled = true; } }
private static void DisplayObstacleControls(UnityEngine.Object target, SceneView sceneView) { EditorGUIUtility.labelWidth = 150f; bool flag = false; bool showObstacleCarveHull = NavMeshVisualizationSettings.showObstacleCarveHull; if (showObstacleCarveHull != EditorGUILayout.Toggle(EditorGUIUtility.TextContent("Show Carve Hull|Shows the hull used to carve the obstacle from navmesh."), showObstacleCarveHull, new GUILayoutOption[0])) { NavMeshVisualizationSettings.showObstacleCarveHull = !showObstacleCarveHull; flag = true; } if (flag) { NavMeshEditorWindow.RepaintSceneAndGameViews(); } }
private void OnInspectorUpdate() { if (this.m_SelectedNavMeshAgentCount > 0) { if (this.m_HasPendingAgentDebugInfo != NavMeshVisualizationSettings.hasPendingAgentDebugInfo) { if (!this.m_HasRepaintedForPendingAgentDebugInfo) { this.m_HasRepaintedForPendingAgentDebugInfo = true; NavMeshEditorWindow.RepaintSceneAndGameViews(); } } else { this.m_HasRepaintedForPendingAgentDebugInfo = false; } } }
private static void DisplayAgentControls(UnityEngine.Object target, SceneView sceneView) { EditorGUIUtility.labelWidth = 150f; bool flag = false; if (Event.current.type == EventType.Layout) { NavMeshEditorWindow.s_NavMeshEditorWindow.m_HasPendingAgentDebugInfo = NavMeshVisualizationSettings.hasPendingAgentDebugInfo; } bool showAgentPath = NavMeshVisualizationSettings.showAgentPath; if (showAgentPath != EditorGUILayout.Toggle(EditorGUIUtility.TextContent("Show Path Polygons|Shows the polygons leading to goal."), showAgentPath, new GUILayoutOption[0])) { NavMeshVisualizationSettings.showAgentPath = !showAgentPath; flag = true; } bool showAgentPathInfo = NavMeshVisualizationSettings.showAgentPathInfo; if (showAgentPathInfo != EditorGUILayout.Toggle(EditorGUIUtility.TextContent("Show Path Query Nodes|Shows the nodes expanded during last path query."), showAgentPathInfo, new GUILayoutOption[0])) { NavMeshVisualizationSettings.showAgentPathInfo = !showAgentPathInfo; flag = true; } bool showAgentNeighbours = NavMeshVisualizationSettings.showAgentNeighbours; if (showAgentNeighbours != EditorGUILayout.Toggle(EditorGUIUtility.TextContent("Show Neighbours|Show the agent neighbours cosidered during simulation."), showAgentNeighbours, new GUILayoutOption[0])) { NavMeshVisualizationSettings.showAgentNeighbours = !showAgentNeighbours; flag = true; } bool showAgentWalls = NavMeshVisualizationSettings.showAgentWalls; if (showAgentWalls != EditorGUILayout.Toggle(EditorGUIUtility.TextContent("Show Walls|Shows the wall segments handled during simulation."), showAgentWalls, new GUILayoutOption[0])) { NavMeshVisualizationSettings.showAgentWalls = !showAgentWalls; flag = true; } bool showAgentAvoidance = NavMeshVisualizationSettings.showAgentAvoidance; if (showAgentAvoidance != EditorGUILayout.Toggle(EditorGUIUtility.TextContent("Show Avoidance|Shows the processed avoidance geometry from simulation."), showAgentAvoidance, new GUILayoutOption[0])) { NavMeshVisualizationSettings.showAgentAvoidance = !showAgentAvoidance; flag = true; } if (showAgentAvoidance) { if (NavMeshEditorWindow.s_NavMeshEditorWindow.m_HasPendingAgentDebugInfo) { EditorGUILayout.BeginVertical(new GUILayoutOption[] { GUILayout.MaxWidth(165f) }); EditorGUILayout.HelpBox("Avoidance display is not valid until after next game update.", MessageType.Warning); EditorGUILayout.EndVertical(); } if (NavMeshEditorWindow.s_NavMeshEditorWindow.m_SelectedNavMeshAgentCount > 10) { EditorGUILayout.BeginVertical(new GUILayoutOption[] { GUILayout.MaxWidth(165f) }); EditorGUILayout.HelpBox(string.Concat(new object[] { "Avoidance visualization can be drawn for ", 10, " agents (", NavMeshEditorWindow.s_NavMeshEditorWindow.m_SelectedNavMeshAgentCount, " selected)." }), MessageType.Warning); EditorGUILayout.EndVertical(); } } if (flag) { NavMeshEditorWindow.RepaintSceneAndGameViews(); } }
private static void DisplayAgentControls(UnityEngine.Object target, SceneView sceneView) { EditorGUIUtility.labelWidth = 150f; bool flag = false; if (Event.current.type == EventType.Layout) { NavMeshEditorWindow.s_NavMeshEditorWindow.m_HasPendingAgentDebugInfo = NavMeshVisualizationSettings.hasPendingAgentDebugInfo; } bool showAgentPath = NavMeshVisualizationSettings.showAgentPath; if (showAgentPath != EditorGUILayout.Toggle(EditorGUIUtility.TextContent("NavMeshEditorWindow.ShowAgentPath"), showAgentPath, new GUILayoutOption[0])) { NavMeshVisualizationSettings.showAgentPath = !showAgentPath; flag = true; } bool showAgentPathInfo = NavMeshVisualizationSettings.showAgentPathInfo; if (showAgentPathInfo != EditorGUILayout.Toggle(EditorGUIUtility.TextContent("NavMeshEditorWindow.ShowAgentPathInfo"), showAgentPathInfo, new GUILayoutOption[0])) { NavMeshVisualizationSettings.showAgentPathInfo = !showAgentPathInfo; flag = true; } bool showAgentNeighbours = NavMeshVisualizationSettings.showAgentNeighbours; if (showAgentNeighbours != EditorGUILayout.Toggle(EditorGUIUtility.TextContent("NavMeshEditorWindow.ShowAgentNeighbours"), showAgentNeighbours, new GUILayoutOption[0])) { NavMeshVisualizationSettings.showAgentNeighbours = !showAgentNeighbours; flag = true; } bool showAgentWalls = NavMeshVisualizationSettings.showAgentWalls; if (showAgentWalls != EditorGUILayout.Toggle(EditorGUIUtility.TextContent("NavMeshEditorWindow.ShowAgentWalls"), showAgentWalls, new GUILayoutOption[0])) { NavMeshVisualizationSettings.showAgentWalls = !showAgentWalls; flag = true; } bool showAgentAvoidance = NavMeshVisualizationSettings.showAgentAvoidance; if (showAgentAvoidance != EditorGUILayout.Toggle(EditorGUIUtility.TextContent("NavMeshEditorWindow.ShowAgentAvoidance"), showAgentAvoidance, new GUILayoutOption[0])) { NavMeshVisualizationSettings.showAgentAvoidance = !showAgentAvoidance; flag = true; } if (showAgentAvoidance) { if (NavMeshEditorWindow.s_NavMeshEditorWindow.m_HasPendingAgentDebugInfo) { EditorGUILayout.BeginVertical(new GUILayoutOption[] { GUILayout.MaxWidth(165f) }); EditorGUILayout.HelpBox("Avoidance display is not valid until after next game update.", MessageType.Warning); EditorGUILayout.EndVertical(); } if (NavMeshEditorWindow.s_NavMeshEditorWindow.m_SelectedNavMeshAgentCount > 10) { EditorGUILayout.BeginVertical(new GUILayoutOption[] { GUILayout.MaxWidth(165f) }); EditorGUILayout.HelpBox(string.Concat(new object[] { "Avoidance visualization can be drawn for ", 10, " agents (", NavMeshEditorWindow.s_NavMeshEditorWindow.m_SelectedNavMeshAgentCount, " selected)." }), MessageType.Warning); EditorGUILayout.EndVertical(); } } if (flag) { NavMeshEditorWindow.RepaintSceneAndGameViews(); } }
public void OnBecameInvisible() { NavMeshVisualizationSettings.showNavigation = false; NavMeshEditorWindow.RepaintSceneAndGameViews(); }
private void BakeSettings() { EditorGUILayout.LabelField(NavMeshEditorWindow.s_Styles.m_AgentSizeHeader, EditorStyles.boldLabel, new GUILayoutOption[0]); this.DrawAgentDiagram(EditorGUILayout.GetControlRect(false, 120f, new GUILayoutOption[0]), this.m_AgentRadius.floatValue, this.m_AgentHeight.floatValue, this.m_AgentClimb.floatValue, this.m_AgentSlope.floatValue); float num1 = EditorGUILayout.FloatField(NavMeshEditorWindow.s_Styles.m_AgentRadiusContent, this.m_AgentRadius.floatValue, new GUILayoutOption[0]); if ((double)num1 >= 1.0 / 1000.0 && !Mathf.Approximately(num1 - this.m_AgentRadius.floatValue, 0.0f)) { this.m_AgentRadius.floatValue = num1; if (!this.m_ManualCellSize.boolValue) { this.m_CellSize.floatValue = (float)(2.0 * (double)this.m_AgentRadius.floatValue / 6.0); } } if ((double)this.m_AgentRadius.floatValue < 0.0500000007450581 && !this.m_ManualCellSize.boolValue) { EditorGUILayout.HelpBox("The agent radius you've set is really small, this can slow down the build.\nIf you intended to allow the agent to move close to the borders and walls, please adjust voxel size in advaced settings to ensure correct bake.", MessageType.Warning); } float num2 = EditorGUILayout.FloatField(NavMeshEditorWindow.s_Styles.m_AgentHeightContent, this.m_AgentHeight.floatValue, new GUILayoutOption[0]); if ((double)num2 >= 1.0 / 1000.0 && !Mathf.Approximately(num2 - this.m_AgentHeight.floatValue, 0.0f)) { this.m_AgentHeight.floatValue = num2; } EditorGUILayout.Slider(this.m_AgentSlope, 0.0f, 60f, NavMeshEditorWindow.s_Styles.m_AgentSlopeContent, new GUILayoutOption[0]); if ((double)this.m_AgentSlope.floatValue > 60.0) { EditorGUILayout.HelpBox("The maximum slope should be set to less than " + (object)60f + " degrees to prevent NavMesh build artifacts on slopes. ", MessageType.Warning); } float num3 = EditorGUILayout.FloatField(NavMeshEditorWindow.s_Styles.m_AgentClimbContent, this.m_AgentClimb.floatValue, new GUILayoutOption[0]); if ((double)num3 >= 0.0 && !Mathf.Approximately(this.m_AgentClimb.floatValue - num3, 0.0f)) { this.m_AgentClimb.floatValue = num3; } if ((double)this.m_AgentClimb.floatValue > (double)this.m_AgentHeight.floatValue) { EditorGUILayout.HelpBox("Step height should be less than agent height.\nClamping step height to " + (object)this.m_AgentHeight.floatValue + " internally when baking.", MessageType.Warning); } float floatValue = this.m_CellSize.floatValue; float num4 = floatValue * 0.5f; int num5 = (int)Mathf.Ceil(this.m_AgentClimb.floatValue / num4); int num6 = (int)Mathf.Ceil(Mathf.Tan((float)((double)this.m_AgentSlope.floatValue / 180.0 * 3.14159274101257)) * floatValue * 2f / num4); if (num6 > num5) { EditorGUILayout.HelpBox("Step Height conflicts with Max Slope. This makes some slopes unwalkable.\nConsider decreasing Max Slope to < " + ((float)((double)Mathf.Atan((float)((double)num5 * (double)num4 / ((double)floatValue * 2.0))) / 3.14159274101257 * 180.0)).ToString("0.0") + " degrees.\nOr, increase Step Height to > " + ((float)(num6 - 1) * num4).ToString("0.00") + ".", MessageType.Warning); } EditorGUILayout.Space(); EditorGUILayout.LabelField(NavMeshEditorWindow.s_Styles.m_OffmeshHeader, EditorStyles.boldLabel, new GUILayoutOption[0]); float num7 = EditorGUILayout.FloatField(NavMeshEditorWindow.s_Styles.m_AgentDropContent, this.m_LedgeDropHeight.floatValue, new GUILayoutOption[0]); if ((double)num7 >= 0.0 && !Mathf.Approximately(num7 - this.m_LedgeDropHeight.floatValue, 0.0f)) { this.m_LedgeDropHeight.floatValue = num7; } float num8 = EditorGUILayout.FloatField(NavMeshEditorWindow.s_Styles.m_AgentJumpContent, this.m_MaxJumpAcrossDistance.floatValue, new GUILayoutOption[0]); if ((double)num8 >= 0.0 && !Mathf.Approximately(num8 - this.m_MaxJumpAcrossDistance.floatValue, 0.0f)) { this.m_MaxJumpAcrossDistance.floatValue = num8; } EditorGUILayout.Space(); this.m_Advanced = GUILayout.Toggle(this.m_Advanced, NavMeshEditorWindow.s_Styles.m_AdvancedHeader, EditorStyles.foldout, new GUILayoutOption[0]); if (this.m_Advanced) { ++EditorGUI.indentLevel; bool flag1 = EditorGUILayout.Toggle(NavMeshEditorWindow.s_Styles.m_ManualCellSizeContent, this.m_ManualCellSize.boolValue, new GUILayoutOption[0]); if (flag1 != this.m_ManualCellSize.boolValue) { this.m_ManualCellSize.boolValue = flag1; if (!flag1) { this.m_CellSize.floatValue = (float)(2.0 * (double)this.m_AgentRadius.floatValue / 6.0); } } EditorGUI.BeginDisabledGroup(!this.m_ManualCellSize.boolValue); ++EditorGUI.indentLevel; float val2 = EditorGUILayout.FloatField(NavMeshEditorWindow.s_Styles.m_CellSizeContent, this.m_CellSize.floatValue, new GUILayoutOption[0]); if ((double)val2 > 0.0 && !Mathf.Approximately(val2 - this.m_CellSize.floatValue, 0.0f)) { this.m_CellSize.floatValue = Math.Max(0.01f, val2); } if ((double)val2 < 0.00999999977648258) { EditorGUILayout.HelpBox("The voxel size should be larger than 0.01.", MessageType.Warning); } float num9 = (double)this.m_CellSize.floatValue <= 0.0 ? 0.0f : this.m_AgentRadius.floatValue / this.m_CellSize.floatValue; EditorGUILayout.LabelField(" ", num9.ToString("0.00") + " voxels per agent radius", EditorStyles.miniLabel, new GUILayoutOption[0]); if (this.m_ManualCellSize.boolValue) { if ((int)Mathf.Floor(this.m_AgentHeight.floatValue / (this.m_CellSize.floatValue * 0.5f)) > 250) { EditorGUILayout.HelpBox("The number of voxels per agent height is too high. This will reduce the accuracy of the navmesh. Consider using voxel size of at least " + ((float)((double)this.m_AgentHeight.floatValue / 250.0 / 0.5)).ToString("0.000") + ".", MessageType.Warning); } if ((double)num9 < 1.0) { EditorGUILayout.HelpBox("The number of voxels per agent radius is too small. The agent may not avoid walls and ledges properly. Consider using voxel size of at least " + (this.m_AgentRadius.floatValue / 2f).ToString("0.000") + " (2 voxels per agent radius).", MessageType.Warning); } else if ((double)num9 > 8.0) { EditorGUILayout.HelpBox("The number of voxels per agent radius is too high. It can cause excessive build times. Consider using voxel size closer to " + (this.m_AgentRadius.floatValue / 8f).ToString("0.000") + " (8 voxels per radius).", MessageType.Warning); } } if (this.m_ManualCellSize.boolValue) { EditorGUILayout.HelpBox("Voxel size controls how accurately the navigation mesh is generated from the level geometry. A good voxel size is 2-4 voxels per agent radius. Making voxel size smaller will increase build time.", MessageType.None); } --EditorGUI.indentLevel; EditorGUI.EndDisabledGroup(); EditorGUILayout.Space(); float num10 = EditorGUILayout.FloatField(NavMeshEditorWindow.s_Styles.m_MinRegionAreaContent, this.m_MinRegionArea.floatValue, new GUILayoutOption[0]); if ((double)num10 >= 0.0 && (double)num10 != (double)this.m_MinRegionArea.floatValue) { this.m_MinRegionArea.floatValue = num10; } EditorGUILayout.Space(); bool flag2 = EditorGUILayout.Toggle(NavMeshEditorWindow.s_Styles.m_AgentPlacementContent, this.m_AccuratePlacement.boolValue, new GUILayoutOption[0]); if (flag2 != this.m_AccuratePlacement.boolValue) { this.m_AccuratePlacement.boolValue = flag2; } --EditorGUI.indentLevel; } if (!Unsupported.IsDeveloperBuild()) { return; } EditorGUILayout.Space(); GUILayout.Label("Internal Bake Debug Options", EditorStyles.boldLabel, new GUILayoutOption[0]); EditorGUILayout.HelpBox("Note: The debug visualization is build during bake, so you'll need to bake for these settings to take effect.", MessageType.None); bool meshLinkSampling = NavMeshVisualizationSettings.showAutoOffMeshLinkSampling; if (meshLinkSampling != EditorGUILayout.Toggle(new GUIContent("Show Auto-Off-MeshLink Sampling"), meshLinkSampling, new GUILayoutOption[0])) { NavMeshVisualizationSettings.showAutoOffMeshLinkSampling = !meshLinkSampling; } bool showVoxels = NavMeshVisualizationSettings.showVoxels; if (showVoxels != EditorGUILayout.Toggle(new GUIContent("Show Voxels"), showVoxels, new GUILayoutOption[0])) { NavMeshVisualizationSettings.showVoxels = !showVoxels; } bool showWalkable = NavMeshVisualizationSettings.showWalkable; if (showWalkable != EditorGUILayout.Toggle(new GUIContent("Show Walkable"), showWalkable, new GUILayoutOption[0])) { NavMeshVisualizationSettings.showWalkable = !showWalkable; } bool showRawContours = NavMeshVisualizationSettings.showRawContours; if (showRawContours != EditorGUILayout.Toggle(new GUIContent("Show Raw Contours"), showRawContours, new GUILayoutOption[0])) { NavMeshVisualizationSettings.showRawContours = !showRawContours; } bool showContours = NavMeshVisualizationSettings.showContours; if (showContours != EditorGUILayout.Toggle(new GUIContent("Show Contours"), showContours, new GUILayoutOption[0])) { NavMeshVisualizationSettings.showContours = !showContours; } bool showInputs = NavMeshVisualizationSettings.showInputs; if (showInputs != EditorGUILayout.Toggle(new GUIContent("Show Inputs"), showInputs, new GUILayoutOption[0])) { NavMeshVisualizationSettings.showInputs = !showInputs; } if (GUILayout.Button("Clear Visualiation Data")) { NavMeshVisualizationSettings.ClearVisualizationData(); NavMeshEditorWindow.RepaintSceneAndGameViews(); } EditorGUILayout.Space(); }
private void BakeSettings() { EditorGUILayout.LabelField(NavMeshEditorWindow.s_Styles.m_AgentSizeHeader, EditorStyles.boldLabel, new GUILayoutOption[0]); Rect controlRect = EditorGUILayout.GetControlRect(false, 120f, new GUILayoutOption[0]); this.DrawAgentDiagram(controlRect, this.m_AgentRadius.floatValue, this.m_AgentHeight.floatValue, this.m_AgentClimb.floatValue, this.m_AgentSlope.floatValue); float num = EditorGUILayout.FloatField(NavMeshEditorWindow.s_Styles.m_AgentRadiusContent, this.m_AgentRadius.floatValue, new GUILayoutOption[0]); if (num >= 0.001f && !Mathf.Approximately(num - this.m_AgentRadius.floatValue, 0f)) { this.m_AgentRadius.floatValue = num; if (!this.m_ManualCellSize.boolValue) { this.m_CellSize.floatValue = 2f * this.m_AgentRadius.floatValue / 6f; } } if (this.m_AgentRadius.floatValue < 0.05f && !this.m_ManualCellSize.boolValue) { EditorGUILayout.HelpBox("The agent radius you've set is really small, this can slow down the build.\nIf you intended to allow the agent to move close to the borders and walls, please adjust voxel size in advaced settings to ensure correct bake.", MessageType.Warning); } float num2 = EditorGUILayout.FloatField(NavMeshEditorWindow.s_Styles.m_AgentHeightContent, this.m_AgentHeight.floatValue, new GUILayoutOption[0]); if (num2 >= 0.001f && !Mathf.Approximately(num2 - this.m_AgentHeight.floatValue, 0f)) { this.m_AgentHeight.floatValue = num2; } EditorGUILayout.Slider(this.m_AgentSlope, 0f, 60f, NavMeshEditorWindow.s_Styles.m_AgentSlopeContent, new GUILayoutOption[0]); if (this.m_AgentSlope.floatValue > 60f) { EditorGUILayout.HelpBox("The maximum slope should be set to less than " + 60f + " degrees to prevent NavMesh build artifacts on slopes. ", MessageType.Warning); } float num3 = EditorGUILayout.FloatField(NavMeshEditorWindow.s_Styles.m_AgentClimbContent, this.m_AgentClimb.floatValue, new GUILayoutOption[0]); if (num3 >= 0f && !Mathf.Approximately(this.m_AgentClimb.floatValue - num3, 0f)) { this.m_AgentClimb.floatValue = num3; } if (this.m_AgentClimb.floatValue > this.m_AgentHeight.floatValue) { EditorGUILayout.HelpBox("Step height should be less than agent height.\nClamping step height to " + this.m_AgentHeight.floatValue + " internally when baking.", MessageType.Warning); } float floatValue = this.m_CellSize.floatValue; float num4 = floatValue * 0.5f; int num5 = (int)Mathf.Ceil(this.m_AgentClimb.floatValue / num4); float num6 = Mathf.Tan(this.m_AgentSlope.floatValue / 180f * 3.14159274f) * floatValue; int num7 = (int)Mathf.Ceil(num6 * 2f / num4); if (num7 > num5) { float f = (float)num5 * num4 / (floatValue * 2f); float num8 = Mathf.Atan(f) / 3.14159274f * 180f; float num9 = (float)(num7 - 1) * num4; EditorGUILayout.HelpBox(string.Concat(new string[] { "Step Height conflicts with Max Slope. This makes some slopes unwalkable.\nConsider decreasing Max Slope to < ", num8.ToString("0.0"), " degrees.\nOr, increase Step Height to > ", num9.ToString("0.00"), "." }), MessageType.Warning); } EditorGUILayout.Space(); EditorGUILayout.LabelField(NavMeshEditorWindow.s_Styles.m_OffmeshHeader, EditorStyles.boldLabel, new GUILayoutOption[0]); float num10 = EditorGUILayout.FloatField(NavMeshEditorWindow.s_Styles.m_AgentDropContent, this.m_LedgeDropHeight.floatValue, new GUILayoutOption[0]); if (num10 >= 0f && !Mathf.Approximately(num10 - this.m_LedgeDropHeight.floatValue, 0f)) { this.m_LedgeDropHeight.floatValue = num10; } float num11 = EditorGUILayout.FloatField(NavMeshEditorWindow.s_Styles.m_AgentJumpContent, this.m_MaxJumpAcrossDistance.floatValue, new GUILayoutOption[0]); if (num11 >= 0f && !Mathf.Approximately(num11 - this.m_MaxJumpAcrossDistance.floatValue, 0f)) { this.m_MaxJumpAcrossDistance.floatValue = num11; } EditorGUILayout.Space(); this.m_Advanced = GUILayout.Toggle(this.m_Advanced, NavMeshEditorWindow.s_Styles.m_AdvancedHeader, EditorStyles.foldout, new GUILayoutOption[0]); if (this.m_Advanced) { EditorGUI.indentLevel++; bool flag = EditorGUILayout.Toggle(NavMeshEditorWindow.s_Styles.m_ManualCellSizeContent, this.m_ManualCellSize.boolValue, new GUILayoutOption[0]); if (flag != this.m_ManualCellSize.boolValue) { this.m_ManualCellSize.boolValue = flag; if (!flag) { this.m_CellSize.floatValue = 2f * this.m_AgentRadius.floatValue / 6f; } } EditorGUI.indentLevel++; using (new EditorGUI.DisabledScope(!this.m_ManualCellSize.boolValue)) { float num12 = EditorGUILayout.FloatField(NavMeshEditorWindow.s_Styles.m_CellSizeContent, this.m_CellSize.floatValue, new GUILayoutOption[0]); if (num12 > 0f && !Mathf.Approximately(num12 - this.m_CellSize.floatValue, 0f)) { this.m_CellSize.floatValue = Math.Max(0.01f, num12); } if (num12 < 0.01f) { EditorGUILayout.HelpBox("The voxel size should be larger than 0.01.", MessageType.Warning); } float num13 = (this.m_CellSize.floatValue <= 0f) ? 0f : (this.m_AgentRadius.floatValue / this.m_CellSize.floatValue); EditorGUILayout.LabelField(" ", num13.ToString("0.00") + " voxels per agent radius", EditorStyles.miniLabel, new GUILayoutOption[0]); if (this.m_ManualCellSize.boolValue) { float num14 = this.m_CellSize.floatValue * 0.5f; if ((int)Mathf.Floor(this.m_AgentHeight.floatValue / num14) > 250) { EditorGUILayout.HelpBox("The number of voxels per agent height is too high. This will reduce the accuracy of the navmesh. Consider using voxel size of at least " + (this.m_AgentHeight.floatValue / 250f / 0.5f).ToString("0.000") + ".", MessageType.Warning); } if (num13 < 1f) { EditorGUILayout.HelpBox("The number of voxels per agent radius is too small. The agent may not avoid walls and ledges properly. Consider using voxel size of at least " + (this.m_AgentRadius.floatValue / 2f).ToString("0.000") + " (2 voxels per agent radius).", MessageType.Warning); } else if (num13 > 8f) { EditorGUILayout.HelpBox("The number of voxels per agent radius is too high. It can cause excessive build times. Consider using voxel size closer to " + (this.m_AgentRadius.floatValue / 8f).ToString("0.000") + " (8 voxels per radius).", MessageType.Warning); } } if (this.m_ManualCellSize.boolValue) { EditorGUILayout.HelpBox("Voxel size controls how accurately the navigation mesh is generated from the level geometry. A good voxel size is 2-4 voxels per agent radius. Making voxel size smaller will increase build time.", MessageType.None); } } EditorGUI.indentLevel--; EditorGUILayout.Space(); float num15 = EditorGUILayout.FloatField(NavMeshEditorWindow.s_Styles.m_MinRegionAreaContent, this.m_MinRegionArea.floatValue, new GUILayoutOption[0]); if (num15 >= 0f && num15 != this.m_MinRegionArea.floatValue) { this.m_MinRegionArea.floatValue = num15; } EditorGUILayout.Space(); bool flag2 = EditorGUILayout.Toggle(NavMeshEditorWindow.s_Styles.m_AgentPlacementContent, this.m_AccuratePlacement.boolValue, new GUILayoutOption[0]); if (flag2 != this.m_AccuratePlacement.boolValue) { this.m_AccuratePlacement.boolValue = flag2; } EditorGUI.indentLevel--; } if (Unsupported.IsDeveloperBuild()) { EditorGUILayout.Space(); GUILayout.Label("Internal Bake Debug Options", EditorStyles.boldLabel, new GUILayoutOption[0]); EditorGUILayout.HelpBox("Note: The debug visualization is build during bake, so you'll need to bake for these settings to take effect.", MessageType.None); bool showAutoOffMeshLinkSampling = NavMeshVisualizationSettings.showAutoOffMeshLinkSampling; if (showAutoOffMeshLinkSampling != EditorGUILayout.Toggle(new GUIContent("Show Auto-Off-MeshLink Sampling"), showAutoOffMeshLinkSampling, new GUILayoutOption[0])) { NavMeshVisualizationSettings.showAutoOffMeshLinkSampling = !showAutoOffMeshLinkSampling; } bool showVoxels = NavMeshVisualizationSettings.showVoxels; if (showVoxels != EditorGUILayout.Toggle(new GUIContent("Show Voxels"), showVoxels, new GUILayoutOption[0])) { NavMeshVisualizationSettings.showVoxels = !showVoxels; } bool showWalkable = NavMeshVisualizationSettings.showWalkable; if (showWalkable != EditorGUILayout.Toggle(new GUIContent("Show Walkable"), showWalkable, new GUILayoutOption[0])) { NavMeshVisualizationSettings.showWalkable = !showWalkable; } bool showRawContours = NavMeshVisualizationSettings.showRawContours; if (showRawContours != EditorGUILayout.Toggle(new GUIContent("Show Raw Contours"), showRawContours, new GUILayoutOption[0])) { NavMeshVisualizationSettings.showRawContours = !showRawContours; } bool showContours = NavMeshVisualizationSettings.showContours; if (showContours != EditorGUILayout.Toggle(new GUIContent("Show Contours"), showContours, new GUILayoutOption[0])) { NavMeshVisualizationSettings.showContours = !showContours; } bool showInputs = NavMeshVisualizationSettings.showInputs; if (showInputs != EditorGUILayout.Toggle(new GUIContent("Show Inputs"), showInputs, new GUILayoutOption[0])) { NavMeshVisualizationSettings.showInputs = !showInputs; } if (GUILayout.Button("Clear Visualiation Data", new GUILayoutOption[0])) { NavMeshVisualizationSettings.ClearVisualizationData(); NavMeshEditorWindow.RepaintSceneAndGameViews(); } EditorGUILayout.Space(); } }