Example #1
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        _target.gradationTexture = (Texture2D)EditorGUILayout.ObjectField("Gradation Texture", _target.gradationTexture, typeof(Texture2D), false, GUILayout.Height(96));
        EditorGUILayout.PropertyField(serializedObject.FindProperty("m_duration"), new GUIContent("Duration"));
        EditorGUILayout.PropertyField(serializedObject.FindProperty("m_playOnAwake"), new GUIContent("Play On Awake"));
        EditorGUILayout.PropertyField(serializedObject.FindProperty("m_flipAfterAnimation"), new GUIContent("Flip After Animation"));
        EditorGUILayout.PropertyField(serializedObject.FindProperty("m_flip"), new GUIContent("Flip"));
        EditorGUILayout.PropertyField(serializedObject.FindProperty("m_invert"), new GUIContent("Invert"));
        EditorGUILayout.PropertyField(serializedObject.FindProperty("m_ignoreTimeScale"), new GUIContent("Ignore Time Scale"));
        EditorGUILayout.PropertyField(serializedObject.FindProperty("m_pingPong"), new GUIContent("Preview Mode"));

        EditorGUILayout.BeginHorizontal();
        _target.curve = EditorGUILayout.CurveField("Transition Curve", _target.curve);
        if (GUILayout.Button("Flip", GUILayout.Width(50)))
        {
            _target.FlipAnimationCurve();
        }
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.Space();
        EditorGUILayout.PropertyField(serializedObject.FindProperty("m_threshold"), new GUIContent("Threshold"));
        EditorGUILayout.PropertyField(serializedObject.FindProperty("onTransitionStart"), new GUIContent("On Transition Start"));
        EditorGUILayout.PropertyField(serializedObject.FindProperty("onTransitionComplete"), new GUIContent("On Transition Complete"));

        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }

        serializedObject.ApplyModifiedProperties();
    }