diff options
author | chai <215380520@qq.com> | 2024-05-23 10:10:23 +0800 |
---|---|---|
committer | chai <215380520@qq.com> | 2024-05-23 10:10:23 +0800 |
commit | 81330a6b68d307937c262368a42a3fa4e9ad4207 (patch) | |
tree | 0616a08be385794e062fb616df4ffb503631ee08 /Other/NavMeshTest/Assets/NavMeshComponents/Editor/NavMeshModifierEditor.cs | |
parent | 8722a9920c1f6119bf6e769cba270e63097f8e25 (diff) |
+ NavMeshTest
Diffstat (limited to 'Other/NavMeshTest/Assets/NavMeshComponents/Editor/NavMeshModifierEditor.cs')
-rw-r--r-- | Other/NavMeshTest/Assets/NavMeshComponents/Editor/NavMeshModifierEditor.cs | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/Other/NavMeshTest/Assets/NavMeshComponents/Editor/NavMeshModifierEditor.cs b/Other/NavMeshTest/Assets/NavMeshComponents/Editor/NavMeshModifierEditor.cs new file mode 100644 index 0000000..a2c636c --- /dev/null +++ b/Other/NavMeshTest/Assets/NavMeshComponents/Editor/NavMeshModifierEditor.cs @@ -0,0 +1,49 @@ +using UnityEngine.AI; + +namespace UnityEditor.AI +{ + [CanEditMultipleObjects] + [CustomEditor(typeof(NavMeshModifier))] + class NavMeshModifierEditor : Editor + { + SerializedProperty m_AffectedAgents; + SerializedProperty m_Area; + SerializedProperty m_IgnoreFromBuild; + SerializedProperty m_OverrideArea; + + void OnEnable() + { + m_AffectedAgents = serializedObject.FindProperty("m_AffectedAgents"); + m_Area = serializedObject.FindProperty("m_Area"); + m_IgnoreFromBuild = serializedObject.FindProperty("m_IgnoreFromBuild"); + m_OverrideArea = serializedObject.FindProperty("m_OverrideArea"); + + NavMeshVisualizationSettings.showNavigation++; + } + + void OnDisable() + { + NavMeshVisualizationSettings.showNavigation--; + } + + public override void OnInspectorGUI() + { + serializedObject.Update(); + + EditorGUILayout.PropertyField(m_IgnoreFromBuild); + + EditorGUILayout.PropertyField(m_OverrideArea); + if (m_OverrideArea.boolValue) + { + EditorGUI.indentLevel++; + NavMeshComponentsGUIUtility.AreaPopup("Area Type", m_Area); + EditorGUI.indentLevel--; + } + + NavMeshComponentsGUIUtility.AgentMaskPopup("Affected Agents", m_AffectedAgents); + EditorGUILayout.Space(); + + serializedObject.ApplyModifiedProperties(); + } + } +} |