private void OnEnable() { M = ((MInput)target); script = MonoScript.FromMonoBehaviour(target as MonoBehaviour); inputs = serializedObject.FindProperty("inputs"); showInputEvents = serializedObject.FindProperty("showInputEvents"); list = new ReorderableList(serializedObject, inputs, true, true, true, true); list.drawElementCallback = DrawElementCallback; list.drawHeaderCallback = HeaderCallbackDelegate; list.onAddCallback = OnAddCallBack; }
protected void CreateInputs() { #if UNITY_EDITOR MInput input = GetComponent <MInput>(); if (input == null) { input = gameObject.AddComponent <MInput>(); } input.IgnoreOnPause.Value = false; #region Open Close Input var OpenCloseInput = input.FindInput("Freeze"); if (OpenCloseInput == null) { OpenCloseInput = new InputRow("Freeze", "Freeze", KeyCode.Escape, InputButton.Down, InputType.Key); input.inputs.Add(OpenCloseInput); UnityEditor.Events.UnityEventTools.AddPersistentListener(OpenCloseInput.OnInputDown, Freeze_Game); } #endregion #region Submit Input var Submit = input.FindInput("Pause Editor"); if (Submit == null) { Submit = new InputRow("Pause Editor", "Pause Editor", KeyCode.P, InputButton.Down, InputType.Key); input.inputs.Add(Submit); UnityEditor.Events.UnityEventTools.AddPersistentListener(Submit.OnInputDown, PauseEditor); } #endregion #region ChangeLeft Input var ChangeLeft = input.FindInput("SlowMo"); if (ChangeLeft == null) { ChangeLeft = new InputRow("SlowMo", "SlowMo", KeyCode.Mouse2, InputButton.Down, InputType.Key); input.inputs.Add(ChangeLeft); UnityEditor.Events.UnityEventTools.AddPersistentListener(ChangeLeft.OnInputDown, Slow_Motion); } #endregion UnityEditor.EditorUtility.SetDirty(this); UnityEditor.EditorUtility.SetDirty(input); #endif }
protected virtual void OnEnable() { MInp = ((MInput)target); script = MonoScript.FromMonoBehaviour(target as MonoBehaviour); inputs = serializedObject.FindProperty("inputs"); OnInputEnabled = serializedObject.FindProperty("OnInputEnabled"); OnInputDisabled = serializedObject.FindProperty("OnInputDisabled"); showInputEvents = serializedObject.FindProperty("showInputEvents"); IgnoreOnPause = serializedObject.FindProperty("IgnoreOnPause"); list = new ReorderableList(serializedObject, inputs, true, true, true, true) { drawElementCallback = DrawElementCallback, drawHeaderCallback = HeaderCallbackDelegate, onAddCallback = OnAddCallBack }; }