private void OnEnable() { m_dpadType = serializedObject.FindProperty("m_dpadType"); m_leftStickButton = serializedObject.FindProperty("m_leftStickButton"); m_rightStickButton = serializedObject.FindProperty("m_rightStickButton"); m_leftBumperButton = serializedObject.FindProperty("m_leftBumperButton"); m_rightBumperButton = serializedObject.FindProperty("m_rightBumperButton"); m_dpadUpButton = serializedObject.FindProperty("m_dpadUpButton"); m_dpadDownButton = serializedObject.FindProperty("m_dpadDownButton"); m_dpadLeftButton = serializedObject.FindProperty("m_dpadLeftButton"); m_dpadRightButton = serializedObject.FindProperty("m_dpadRightButton"); m_backButton = serializedObject.FindProperty("m_backButton"); m_startButton = serializedObject.FindProperty("m_startButton"); m_actionTopButton = serializedObject.FindProperty("m_actionTopButton"); m_actionBottomButton = serializedObject.FindProperty("m_actionBottomButton"); m_actionLeftButton = serializedObject.FindProperty("m_actionLeftButton"); m_actionRightButton = serializedObject.FindProperty("m_actionRightButton"); m_leftStickXAxis = serializedObject.FindProperty("m_leftStickXAxis"); m_leftStickYAxis = serializedObject.FindProperty("m_leftStickYAxis"); m_rightStickXAxis = serializedObject.FindProperty("m_rightStickXAxis"); m_rightStickYAxis = serializedObject.FindProperty("m_rightStickYAxis"); m_dpadXAxis = serializedObject.FindProperty("m_dpadXAxis"); m_dpadYAxis = serializedObject.FindProperty("m_dpadYAxis"); m_leftTriggerAxis = serializedObject.FindProperty("m_leftTriggerAxis"); m_rightTriggerAxis = serializedObject.FindProperty("m_rightTriggerAxis"); m_buttonNames = EditorToolbox.GenerateJoystickButtonNames(); m_axisNames = EditorToolbox.GenerateJoystickAxisNames(); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); serializedObject.Update(); UpdateControlSchemeNames(); EditorGUILayout.Space(); for (int i = 0; i < InputManager.maxPlayers; i++) { DrawControlSchemeDropdown(m_playerDefaults.GetArrayElementAtIndex(i), i); } EditorGUILayout.Space(); GUILayout.BeginHorizontal(); GUI.enabled = !InputEditor.IsOpen; if (GUILayout.Button("Input\nEditor", GUILayout.Height(BUTTON_HEIGHT))) { InputEditor.OpenWindow(m_inputManager); } GUI.enabled = true; if (GUILayout.Button(m_createSnapshotInfo, GUILayout.Height(BUTTON_HEIGHT))) { EditorToolbox.CreateSnapshot(m_inputManager); } GUI.enabled = EditorToolbox.CanLoadSnapshot(); if (GUILayout.Button("Restore\nSnapshot", GUILayout.Height(BUTTON_HEIGHT))) { EditorToolbox.LoadSnapshot(m_inputManager); } GUI.enabled = true; GUILayout.EndHorizontal(); serializedObject.ApplyModifiedProperties(); EditorUtility.SetDirty(serializedObject.targetObject); // UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(m_inputManager.gameObject.scene); }