public void RemoveInput(EF_Base_Input anInput) { if (anInput) { m_Inputs.Remove(anInput); UnityEngine.Object.DestroyImmediate(anInput, true); EditorUtility.SetDirty(this); AssetDatabase.SaveAssets(); } }
void OnGUI() { GUILayout.BeginVertical(); wantedName = EditorGUILayout.TextField("Input Name: ", wantedName); wantedType = (InputType)EditorGUILayout.EnumPopup("Input Type: ", wantedType); GUILayout.BeginHorizontal("", GUILayout.ExpandWidth(true)); if (GUILayout.Button("Create")) { var newInput = new EF_Base_Input(); switch (wantedType) { case InputType.Keyboard: newInput = new EF_Keyboard_Input() as EF_Keyboard_Input; newInput.inputName = wantedName; newInput.m_InputType = InputType.Keyboard; break; case InputType.Xbox: newInput = new EF_Joystick_Input() as EF_Joystick_Input; newInput.inputName = wantedName; newInput.m_InputType = InputType.Xbox; newInput.m_XAxis = "4ThAxis"; newInput.m_YAxis = "5ThAxis"; break; case InputType.PS4: newInput = new EF_Joystick_Input() as EF_Joystick_Input; newInput.inputName = wantedName; newInput.m_InputType = InputType.PS4; newInput.m_XAxis = "3rdAxis"; newInput.m_YAxis = "6ThAxis"; break; case InputType.Vive: newInput = new EF_Joystick_Input() as EF_Joystick_Input; newInput.inputName = wantedName; newInput.m_InputType = InputType.Vive; break; default: break; } if (OnComplete != null) { InputPopupArgs args = new InputPopupArgs(); args.curInput = newInput; OnComplete(this, args); } this.Close(); } if (GUILayout.Button("Close")) { this.Close(); } GUILayout.EndHorizontal(); GUILayout.EndVertical(); }