public override void OnInspectorGUI() { serializedObject.Update(); EditorGUI.LabelField(EditorUtilities.GetRect(36), "Input Bindings", Styling.headerLabel); using (new EditorGUILayout.HorizontalScope()) { GUILayout.FlexibleSpace(); m_ToolbarIndex = GUILayout.Toolbar(m_ToolbarIndex, new[] { "Axes", "Buttons" }, GUILayout.Height(24), GUILayout.Width(256)); GUILayout.FlexibleSpace(); } EditorGUILayout.Space(); switch (m_ToolbarIndex) { case 0: { for (int i = 0; i < m_Axes.arraySize; i++) { AxisDrawer(m_Axes.GetArrayElementAtIndex(i), i); } EditorUtilities.DrawSplitter(); EditorGUILayout.Space(); using (new EditorGUILayout.HorizontalScope()) { GUILayout.FlexibleSpace(); EditorGUI.BeginChangeCheck(); if (GUILayout.Button("New Axis", Styling.button, GUILayout.Height(28), GUILayout.Width(256))) { if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(m_Target, "Undo Inspector"); m_Target.AddAxis("Axis", string.Empty, string.Empty, 1, 1, 0.01f); EditorUtility.SetDirty(m_Target); return; } } GUILayout.FlexibleSpace(); } break; } case 1: { for (int i = 0; i < m_Buttons.arraySize; i++) { ButtonDrawer(m_Buttons.GetArrayElementAtIndex(i), i); } EditorUtilities.DrawSplitter(); EditorGUILayout.Space(); using (new EditorGUILayout.HorizontalScope()) { GUILayout.FlexibleSpace(); EditorGUI.BeginChangeCheck(); if (GUILayout.Button("New Button", Styling.button, GUILayout.Height(28), GUILayout.Width(256))) { if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(m_Target, "Undo Inspector"); m_Target.AddButton("Button", string.Empty); EditorUtility.SetDirty(m_Target); return; } } GUILayout.FlexibleSpace(); } break; } } serializedObject.ApplyModifiedProperties(); }