コード例 #1
0
 public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
 {
     if (Input_Manager.Exists())
     {
         SerializedProperty currentKeyIndex = property.FindPropertyRelative("currentKeyIndex");
         EditorGUI.BeginProperty(position, label, property);
         position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
         currentKeyIndex.intValue = EditorGUI.Popup(position, currentKeyIndex.intValue, Input_Manager.instance.getKeyNames());
         EditorGUI.EndProperty();
     }
 }
コード例 #2
0
    public override void OnInspectorGUI()
    {
        if (Input_Manager.Exists())
        {
            if (GUILayout.Button("Add Key"))
            {
                Input_Manager.instance.keysList.Add(new InputKeysValues());
            }

            if (GUILayout.Button("Remove Key"))
            {
                if (Input_Manager.instance.keysList.Count != 0)
                {
                    Input_Manager.instance.keysList.RemoveAt(Input_Manager.instance.keysList.Count - 1);
                }
            }
            DrawDefaultInspector();
        }
    }