public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            EditorGUI.BeginProperty(position, label, property);

            var typeRect = new Rect(position.x, position.y, position.width, 15);

            EditorGUI.PropertyField(typeRect, property.FindPropertyRelative("inputType"), GUIContent.none);

            InputDefinitionType enumType = (InputDefinitionType)property.FindPropertyRelative("inputType").enumValueIndex;

            switch (enumType)
            {
            case InputDefinitionType.Button:
                var buttonRect = new Rect(position.x, position.y + 20, position.width, 20);
                EditorGUI.PropertyField(buttonRect, property.FindPropertyRelative("buttonID"), new GUIContent("ID"));
                break;

            case InputDefinitionType.Stick:
                var stickRect = new Rect(position.x, position.y + 20, position.width, 20);
                EditorGUI.PropertyField(stickRect, property.FindPropertyRelative("stickDirection"), GUIContent.none);
                var dirRect = new Rect(position.x, position.y + 40, position.width, 20);
                EditorGUI.PropertyField(dirRect, property.FindPropertyRelative("directionDeviation"), new GUIContent("Deviation"));
                break;
            }

            EditorGUI.EndProperty();
        }
        public float directionDeviation = 0.9f; // Directions are compared using dot product.

        public virtual void DrawInspector()
        {
#if UNITY_EDITOR
            inputType = (InputDefinitionType)EditorGUILayout.EnumPopup(inputType);
            switch (inputType)
            {
            case InputDefinitionType.Button:
                buttonID = EditorGUILayout.IntField("ID", buttonID);
                break;

            case InputDefinitionType.Stick:
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("X");
                stickDirection.x = EditorGUILayout.FloatField(stickDirection.x);
                EditorGUILayout.LabelField("Y");
                stickDirection.y = EditorGUILayout.FloatField(stickDirection.y);
                EditorGUILayout.EndHorizontal();
                directionDeviation = EditorGUILayout.FloatField("Deviation", directionDeviation);
                break;
            }
#endif
        }
        public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
        {
            InputDefinitionType enumType = (InputDefinitionType)property.FindPropertyRelative("inputType").enumValueIndex;

            return(enumType == InputDefinitionType.Button ? 45 : 70);
        }