Example #1
0
        /// <inheritdoc />
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            if (SOFlowEditorSettings.DrawDefaultProperties)
            {
                EditorGUI.PropertyField(position, property, label);
            }
            else
            {
                label = EditorGUI.BeginProperty(position, label, property);

                position.height = EditorGUIUtility.singleLineHeight;
                EditorGUI.PropertyField(position, property, label);

                if (property.objectReferenceValue == null)
                {
                    _referenceApplied = false;
                }
                else
                {
                    _referenceApplied = true;

                    Fadable fadable = property.objectReferenceValue as Fadable;

                    if (fadable != null)
                    {
                        position.y += EditorGUIUtility.singleLineHeight;

                        position.width /= 3f;

                        fadable.AlphaOnly.Value = EditorGUI.ToggleLeft(position, "Alpha Only", fadable.AlphaOnly,
                                                                       SOFlowStyles.CenteredLabel);

                        position.x += position.width;

                        fadable.InvertAlpha.Value = EditorGUI.ToggleLeft(position, "Invert Alpha", fadable.InvertAlpha,
                                                                         SOFlowStyles.CenteredLabel);

                        position.x += position.width;

                        fadable.InvertPercentage.Value = EditorGUI.ToggleLeft(position, "Invert %", fadable.InvertPercentage,
                                                                              SOFlowStyles.CenteredLabel);
                    }
                }

                EditorGUI.EndProperty();
            }
        }
Example #2
0
        /// <inheritdoc />
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            label = EditorGUI.BeginProperty(position, label, property);

            position.height = EditorGUIUtility.singleLineHeight;
            EditorGUI.PropertyField(position, property, label);

            if (property.objectReferenceValue == null)
            {
                _referenceApplied = false;
            }
            else
            {
                _referenceApplied = true;

                Fadable fadable = property.objectReferenceValue as Fadable;

                if (fadable != null)
                {
                    position.y += EditorGUIUtility.singleLineHeight;

                    position.width /= 3f;

                    fadable.AlphaOnly = EditorGUI.ToggleLeft(position, "Alpha Only", fadable.AlphaOnly);

                    position.x += position.width;

                    fadable.InvertAlpha = EditorGUI.ToggleLeft(position, "Invert Alpha", fadable.InvertAlpha);

                    position.x += position.width;

                    fadable.InvertPercentage = EditorGUI.ToggleLeft(position, "Invert %", fadable.InvertPercentage);
                }

                EditorGUI.EndProperty();
            }
        }