public override void OnInspectorGUI() { m_KeyboardUI = (KeyboardUI)target; var labelWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 100f; serializedObject.Update(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Button"); EditorGUILayout.LabelField("Vertical Slots"); EditorGUILayout.LabelField("Horizontal Slots"); EditorGUILayout.EndHorizontal(); for (int i = 0; i < m_ButtonsProperty.arraySize; i++) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.PropertyField(m_ButtonsProperty.GetArrayElementAtIndex(i)); EditorGUILayout.PropertyField(m_VerticalLayoutTransformsProperty.GetArrayElementAtIndex(i), GUIContent.none); EditorGUILayout.PropertyField(m_HorizontalLayoutTransformsProperty.GetArrayElementAtIndex(i), GUIContent.none); EditorGUILayout.EndHorizontal(); } EditorGUILayout.PropertyField(m_DirectManipulatorProperty); EditorGUILayout.PropertyField(m_SmoothMotionProperty); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Vertical layout")) { m_KeyboardUI.ForceMoveButtonsToVerticalLayout(); } if (GUILayout.Button("Horizontal layout")) { m_KeyboardUI.ForceMoveButtonsToHorizontalLayout(); } EditorGUILayout.EndHorizontal(); serializedObject.ApplyModifiedProperties(); EditorGUIUtility.labelWidth = labelWidth; }
/// <summary> /// Open a keyboard for this input field /// </summary> public virtual void OpenKeyboard() { if (m_KeyboardOpen) { return; } m_KeyboardOpen = true; m_Keyboard = spawnKeyboard(); m_Keyboard.gameObject.SetActive(true); this.StopCoroutine(ref m_MoveKeyboardCoroutine); var keyboardOutOfRange = (m_Keyboard.transform.position - transform.position).magnitude > 0.25f; m_MoveKeyboardCoroutine = StartCoroutine(MoveKeyboardToInputField(keyboardOutOfRange)); #if UNITY_EDITOR UnityEditor.Undo.IncrementCurrentGroup(); // Every time we open the keyboard is a new modification #endif }
void FinalizeClose() { m_Keyboard.gameObject.SetActive(false); m_Keyboard = null; }