예제 #1
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            label = EditorGUI.BeginProperty(position, label, property);
            float standardHeight = EditorGUI.GetPropertyHeight(property, true);

            position.height = standardHeight;
            SerializedProperty propEnabled = property.FindPropertyRelative("enabled");
            SerializedProperty propValue   = property.FindPropertyRelative("value");

            GUIContent toggleLabel = propEnabled.boolValue ? new GUIContent() : label;
            Rect       toggleRect  = position;

            if (propEnabled.boolValue)
            {
                toggleRect.width = 15;
            }
            propEnabled.boolValue = EditorGUI.ToggleLeft(toggleRect, toggleLabel, propEnabled.boolValue);
            position.x           += 17;
            if (propEnabled.boolValue)
            {
                propValue.floatValue = EditorGUI.FloatField(position, label, propValue.floatValue);
            }
            OptionalFloat target = EditorGUIHelper.GetPropertyParent(propValue) as OptionalFloat;

            if (target.onValueChange != null)
            {
                target.onValueChange.Invoke();
            }
            property.serializedObject.ApplyModifiedProperties();
            EditorGUI.EndProperty();
        }
예제 #2
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            EditorGUIHelper.ProfilePropertyAndNewButtonGUI(position, property, label, () => CreateNewProfile(property));

            GrassPostProcessProfile myTarget = (property.objectReferenceValue as GrassPostProcessProfile);

            if (null == myTarget)
            {
                return;
            }

            PostProcessesGUI(myTarget, property);
        }
예제 #3
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            property.serializedObject.Update();
            position.height = EditorGUI.GetPropertyHeight(property, label, true);
            EditorGUIHelper.ProfilePropertyAndNewButtonGUI(position, property, label, () => CreateNewMaterialProfileMenu(property));

            property.serializedObject.ApplyModifiedProperties();
            property.serializedObject.Update();
            property.isExpanded = true;
            if (property.objectReferenceValue == null)
            {
                return;
            }
            DrawAllChildrensGUI(position, property);
            property.serializedObject.ApplyModifiedProperties();
        }