public override void OnInspectorGUI()
        {
            serializedObject.Update();

            RefreshEventRef();

            var ev       = serializedObject.FindProperty("eventName");
            var stopType = serializedObject.FindProperty("stopType");

            EditorGUILayout.PropertyField(ev, new GUIContent("Event"));
            EditorGUILayout.PropertyField(stopType, new GUIContent("Stop Mode"));

            DrawInitialParameterValues();
            DrawParameterAutomations();

            eventPlayable.OnValidate();

            serializedObject.ApplyModifiedProperties();
        }
Exemple #2
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            RefreshEventRef();

            var eventReference = serializedObject.FindProperty("eventReference");
            var stopType       = serializedObject.FindProperty("stopType");

            const string EventReferenceLabel = "Event";

            EditorUtils.DrawLegacyEvent(serializedObject.FindProperty("eventName"), EventReferenceLabel);

            EditorGUILayout.PropertyField(eventReference, new GUIContent(EventReferenceLabel));
            EditorGUILayout.PropertyField(stopType, new GUIContent("Stop Mode"));

            DrawInitialParameterValues();
            DrawParameterAutomations();

            eventPlayable.OnValidate();

            serializedObject.ApplyModifiedProperties();
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            var ev       = serializedObject.FindProperty("eventName");
            var stopType = serializedObject.FindProperty("stopType");

            EditorGUILayout.PropertyField(ev, new GUIContent("Event"));

            var eventRef = EventManager.EventFromPath(ev.stringValue);

            if (eventRef != null && eventRef.Parameters.Count > 0)
            {
                foreach (var paramRef in eventRef.Parameters)
                {
                    bool  set;
                    float value;
                    CheckParameter(paramRef.Name, out set, out value);

                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel(paramRef.Name);
                    EditorGUI.BeginChangeCheck();
                    bool newSet = EditorGUILayout.Toggle(set, GUILayout.Width(20));

                    if (EditorGUI.EndChangeCheck())
                    {
                        Undo.RecordObjects(new UnityEngine.Object[] { serializedObject.targetObject }, "Inspector");
                        if (newSet)
                        {
                            AddParameterValue(serializedObject.targetObject, paramRef.Name, paramRef.Default);
                        }
                        else
                        {
                            DeleteParameterValue(serializedObject.targetObject, paramRef.Name);
                        }
                        set = newSet;
                    }

                    if (set)
                    {
                        EditorGUI.BeginChangeCheck();
                        value = EditorGUILayout.Slider(value, paramRef.Min, paramRef.Max);
                        if (EditorGUI.EndChangeCheck())
                        {
                            Undo.RecordObjects(new UnityEngine.Object[] { serializedObject.targetObject }, "Inspector");
                            SetParameterValue(serializedObject.targetObject, paramRef.Name, value);
                        }
                    }
                    else
                    {
                        EditorGUILayout.Slider(paramRef.Default, paramRef.Min, paramRef.Max);
                    }
                    EditorGUILayout.EndHorizontal();
                }
            }

            EditorGUILayout.PropertyField(stopType, new GUIContent("Stop Mode"));

            if (eventPlayable)
            {
                eventPlayable.OnValidate();
            }
            serializedObject.ApplyModifiedProperties();
        }