예제 #1
0
        public override bool OnInspectorGUI(Volume[] selectedVolumes)
        {
            var  volumes    = selectedVolumes.Cast <UsableTriggerVolume>();
            bool invalidate = false;

            GUILayout.BeginVertical("Box");
            {
                EditorGUILayout.LabelField("Trigger Options", EditorStyles.boldLabel);
                GUILayout.Space(4);
                EditorGUI.indentLevel = 1;

                GUILayout.BeginVertical();
                {
                    LayerMask previousLayerMask;
                    layer = SabreGUILayout.LayerMaskField(new GUIContent("Layer Mask", "The layer mask to limit the colliders that can invoke the trigger."), (previousLayerMask = layer).value);
                    if (previousLayerMask != layer)
                    {
                        foreach (UsableTriggerVolume volume in volumes)
                        {
                            volume.layer = layer;
                        }
                        invalidate = true;
                    }

                    bool previousUseFilterTag;
                    useFilterTag = EditorGUILayout.Toggle(new GUIContent("Use Filter Tag", "Whether to use a filter tag."), previousUseFilterTag = useFilterTag);
                    if (useFilterTag != previousUseFilterTag)
                    {
                        foreach (UsableTriggerVolume volume in volumes)
                        {
                            volume.useFilterTag = useFilterTag;
                        }
                        invalidate = true;
                    }

                    if (useFilterTag)
                    {
                        string previousFilterTag;
                        filterTag = EditorGUILayout.TagField(new GUIContent("Filter Tag", "The filter tag to limit the colliders that can invoke the trigger."), previousFilterTag = filterTag);
                        if (filterTag != previousFilterTag)
                        {
                            foreach (UsableTriggerVolume volume in volumes)
                            {
                                volume.filterTag = filterTag;
                            }
                            invalidate = true;
                        }
                    }

                    bool previousTriggerOnce;
                    triggerOnceOnly = EditorGUILayout.Toggle(new GUIContent("Trigger Once Only", "Whether the trigger can only be instigated once."), previousTriggerOnce = triggerOnceOnly);
                    if (triggerOnceOnly != previousTriggerOnce)
                    {
                        foreach (UsableTriggerVolume volume in volumes)
                        {
                            volume.triggerOnceOnly = triggerOnceOnly;
                        }
                        invalidate = true;
                    }
                }
                GUILayout.EndVertical();

                EditorGUI.indentLevel = 0;
            }
            GUILayout.EndVertical();
            GUILayout.BeginVertical("Box");
            {
                EditorGUILayout.LabelField("Use Settings", EditorStyles.boldLabel);
                GUILayout.Space(4);

                EditorGUI.indentLevel = 1;

                UseInputType oldUseInputType;
                useInputType = (UseInputType)EditorGUILayout.EnumPopup(new GUIContent("Input Type"), oldUseInputType = useInputType);
                if (useInputType != oldUseInputType)
                {
                    foreach (UsableTriggerVolume volume in volumes)
                    {
                        volume.useInputType = useInputType;
                    }
                    invalidate = true;
                }

                switch (useInputType)
                {
                case UseInputType.InputManager:
                    string oldInputEventName;
                    inputEventName = EditorGUILayout.TextField(new GUIContent("Input Button", "The name of the input button set up in the input manager."), oldInputEventName = inputEventName);
                    if (inputEventName != oldInputEventName)
                    {
                        foreach (UsableTriggerVolume volume in volumes)
                        {
                            volume.inputEventName = inputEventName;
                        }
                        invalidate = true;
                    }

                    break;

                case UseInputType.KeyCode:
                    KeyCode oldInputKey;
                    inputKey = (KeyCode)EditorGUILayout.EnumPopup(new GUIContent("Input Key"), oldInputKey = inputKey);
                    if (inputKey != oldInputKey)
                    {
                        foreach (UsableTriggerVolume volume in volumes)
                        {
                            volume.inputKey = inputKey;
                        }
                        invalidate = true;
                    }

                    break;
                }

                EditorGUI.indentLevel = 0;
            }
            GUILayout.EndVertical();

            GUILayout.BeginVertical("Box");
            {
                EditorGUILayout.LabelField("Trigger Events", EditorStyles.boldLabel);
                GUILayout.Space(4);

                EditorGUI.indentLevel = 1;

                GUILayout.BeginVertical();
                {
                    SerializedObject   tv    = new SerializedObject(this);
                    SerializedProperty prop1 = tv.FindProperty("onUseEvent");

                    EditorGUI.BeginChangeCheck();

                    EditorGUILayout.PropertyField(prop1, new GUIContent("On Use Event"));

                    if (EditorGUI.EndChangeCheck())
                    {
                        tv.ApplyModifiedProperties();
                        foreach (UsableTriggerVolume volume in volumes)
                        {
                            volume.onUseEvent = onUseEvent;
                        }
                        invalidate = true;
                    }
                }
                GUILayout.EndVertical();

                EditorGUI.indentLevel = 0;
            }
            GUILayout.EndVertical();

            return(invalidate);
        }
예제 #2
0
        /// <summary>
        /// Called when the inspector GUI is drawn in the editor.
        /// </summary>
        /// <param name="selectedVolumes">The selected volumes in the editor (for multi-editing).</param>
        /// <returns>True if a property changed or else false.</returns>
        public override bool OnInspectorGUI(Volume[] selectedVolumes)
        {
            var  physicsVolumes = selectedVolumes.Cast <PhysicsVolume>();
            bool invalidate     = false;

            // global force:

            GUILayout.BeginVertical("Box");
            {
                UnityEditor.EditorGUILayout.LabelField("Force Options", UnityEditor.EditorStyles.boldLabel);
                GUILayout.Space(4);

                UnityEditor.EditorGUI.indentLevel = 1;
                GUILayout.BeginVertical();
                {
                    PhysicsVolumeForceMode previousPhysicsVolumeForceMode;
                    forceMode = (PhysicsVolumeForceMode)UnityEditor.EditorGUILayout.EnumPopup(new GUIContent("Force Mode", "The force mode."), previousPhysicsVolumeForceMode = forceMode);
                    if (previousPhysicsVolumeForceMode != forceMode)
                    {
                        foreach (PhysicsVolume volume in physicsVolumes)
                        {
                            volume.forceMode = forceMode;
                        }
                        invalidate = true;
                    }

                    if (forceMode != PhysicsVolumeForceMode.None)
                    {
                        Vector3 previousVector3;
                        UnityEditor.EditorGUIUtility.wideMode = true;
                        force = UnityEditor.EditorGUILayout.Vector3Field(new GUIContent("Force", "The amount of force."), previousVector3 = force);
                        UnityEditor.EditorGUIUtility.wideMode = false;
                        if (previousVector3 != force)
                        {
                            foreach (PhysicsVolume volume in physicsVolumes)
                            {
                                volume.force = force;
                            }
                            invalidate = true;
                        }

                        PhysicsVolumeForceSpace previousPhysicsVolumeForceSpace;
                        forceSpace = (PhysicsVolumeForceSpace)UnityEditor.EditorGUILayout.EnumPopup(new GUIContent("Force Space", "The force space mode."), previousPhysicsVolumeForceSpace = forceSpace);
                        if (previousPhysicsVolumeForceSpace != forceSpace)
                        {
                            foreach (PhysicsVolume volume in physicsVolumes)
                            {
                                volume.forceSpace = forceSpace;
                            }
                            invalidate = true;
                        }
                    }
                }
                GUILayout.EndVertical();
                UnityEditor.EditorGUI.indentLevel = 0;
            }
            GUILayout.EndVertical();

            // relative force:

            GUILayout.BeginVertical("Box");
            {
                UnityEditor.EditorGUILayout.LabelField("Relative Force Options", UnityEditor.EditorStyles.boldLabel);
                GUILayout.Space(4);

                UnityEditor.EditorGUI.indentLevel = 1;
                GUILayout.BeginVertical();
                {
                    PhysicsVolumeForceMode previousPhysicsVolumeRelativeForceMode;
                    relativeForceMode = (PhysicsVolumeForceMode)UnityEditor.EditorGUILayout.EnumPopup(new GUIContent("Force Mode", "The relative force mode."), previousPhysicsVolumeRelativeForceMode = relativeForceMode);
                    if (previousPhysicsVolumeRelativeForceMode != relativeForceMode)
                    {
                        foreach (PhysicsVolume volume in physicsVolumes)
                        {
                            volume.relativeForceMode = relativeForceMode;
                        }
                        invalidate = true;
                    }

                    if (relativeForceMode != PhysicsVolumeForceMode.None)
                    {
                        Vector3 previousVector3;
                        UnityEditor.EditorGUIUtility.wideMode = true;
                        relativeForce = UnityEditor.EditorGUILayout.Vector3Field(new GUIContent("Force", "The amount of relative force."), previousVector3 = relativeForce);
                        UnityEditor.EditorGUIUtility.wideMode = false;
                        if (previousVector3 != relativeForce)
                        {
                            foreach (PhysicsVolume volume in physicsVolumes)
                            {
                                volume.relativeForce = relativeForce;
                            }
                            invalidate = true;
                        }

                        PhysicsVolumeForceSpace previousPhysicsVolumeForceSpace;
                        relativeForceSpace = (PhysicsVolumeForceSpace)UnityEditor.EditorGUILayout.EnumPopup(new GUIContent("Force Space", "The relative force space mode."), previousPhysicsVolumeForceSpace = relativeForceSpace);
                        if (previousPhysicsVolumeForceSpace != relativeForceSpace)
                        {
                            foreach (PhysicsVolume volume in physicsVolumes)
                            {
                                volume.relativeForceSpace = relativeForceSpace;
                            }
                            invalidate = true;
                        }
                    }
                }
                GUILayout.EndVertical();
                UnityEditor.EditorGUI.indentLevel = 0;
            }
            GUILayout.EndVertical();

            // global torque:

            GUILayout.BeginVertical("Box");
            {
                UnityEditor.EditorGUILayout.LabelField("Torque Options", UnityEditor.EditorStyles.boldLabel);
                GUILayout.Space(4);

                UnityEditor.EditorGUI.indentLevel = 1;
                GUILayout.BeginVertical();
                {
                    PhysicsVolumeForceMode previousPhysicsVolumeTorqueForceMode;
                    torqueForceMode = (PhysicsVolumeForceMode)UnityEditor.EditorGUILayout.EnumPopup(new GUIContent("Force Mode", "The torque force mode."), previousPhysicsVolumeTorqueForceMode = torqueForceMode);
                    if (previousPhysicsVolumeTorqueForceMode != torqueForceMode)
                    {
                        foreach (PhysicsVolume volume in physicsVolumes)
                        {
                            volume.torqueForceMode = torqueForceMode;
                        }
                        invalidate = true;
                    }

                    if (torqueForceMode != PhysicsVolumeForceMode.None)
                    {
                        Vector3 previousVector3;
                        UnityEditor.EditorGUIUtility.wideMode = true;
                        torque = UnityEditor.EditorGUILayout.Vector3Field(new GUIContent("Force", "The amount of torque force."), previousVector3 = torque);
                        UnityEditor.EditorGUIUtility.wideMode = false;
                        if (previousVector3 != torque)
                        {
                            foreach (PhysicsVolume volume in physicsVolumes)
                            {
                                volume.torque = torque;
                            }
                            invalidate = true;
                        }

                        PhysicsVolumeForceSpace previousPhysicsVolumeForceSpace;
                        torqueSpace = (PhysicsVolumeForceSpace)UnityEditor.EditorGUILayout.EnumPopup(new GUIContent("Force Space", "The torque force space mode."), previousPhysicsVolumeForceSpace = torqueSpace);
                        if (previousPhysicsVolumeForceSpace != torqueSpace)
                        {
                            foreach (PhysicsVolume volume in physicsVolumes)
                            {
                                volume.torqueSpace = torqueSpace;
                            }
                            invalidate = true;
                        }
                    }
                }
                GUILayout.EndVertical();
                UnityEditor.EditorGUI.indentLevel = 0;
            }
            GUILayout.EndVertical();

            // relative torque:

            GUILayout.BeginVertical("Box");
            {
                UnityEditor.EditorGUILayout.LabelField("Relative Torque Options", UnityEditor.EditorStyles.boldLabel);
                GUILayout.Space(4);

                UnityEditor.EditorGUI.indentLevel = 1;
                GUILayout.BeginVertical();
                {
                    PhysicsVolumeForceMode previousPhysicsVolumeRelativeTorqueForceMode;
                    relativeTorqueForceMode = (PhysicsVolumeForceMode)UnityEditor.EditorGUILayout.EnumPopup(new GUIContent("Force Mode", "The relative torque force mode."), previousPhysicsVolumeRelativeTorqueForceMode = relativeTorqueForceMode);
                    if (previousPhysicsVolumeRelativeTorqueForceMode != relativeTorqueForceMode)
                    {
                        foreach (PhysicsVolume volume in physicsVolumes)
                        {
                            volume.relativeTorqueForceMode = relativeTorqueForceMode;
                        }
                        invalidate = true;
                    }

                    if (relativeTorqueForceMode != PhysicsVolumeForceMode.None)
                    {
                        Vector3 previousVector3;
                        UnityEditor.EditorGUIUtility.wideMode = true;
                        relativeTorque = UnityEditor.EditorGUILayout.Vector3Field(new GUIContent("Force", "The amount of relative torque force."), previousVector3 = relativeTorque);
                        UnityEditor.EditorGUIUtility.wideMode = false;
                        if (previousVector3 != relativeTorque)
                        {
                            foreach (PhysicsVolume volume in physicsVolumes)
                            {
                                volume.relativeTorque = relativeTorque;
                            }
                            invalidate = true;
                        }

                        PhysicsVolumeForceSpace previousPhysicsVolumeForceSpace;
                        relativeTorqueSpace = (PhysicsVolumeForceSpace)UnityEditor.EditorGUILayout.EnumPopup(new GUIContent("Force Space", "The relative torque force space mode."), previousPhysicsVolumeForceSpace = relativeTorqueSpace);
                        if (previousPhysicsVolumeForceSpace != relativeTorqueSpace)
                        {
                            foreach (PhysicsVolume volume in physicsVolumes)
                            {
                                volume.relativeTorqueSpace = relativeTorqueSpace;
                            }
                            invalidate = true;
                        }
                    }
                }
                GUILayout.EndVertical();
                UnityEditor.EditorGUI.indentLevel = 0;
            }
            GUILayout.EndVertical();

            // general options:

            GUILayout.BeginVertical("Box");
            {
                UnityEditor.EditorGUILayout.LabelField("General Options", UnityEditor.EditorStyles.boldLabel);
                GUILayout.Space(4);

                UnityEditor.EditorGUI.indentLevel = 1;
                GUILayout.BeginVertical();
                {
                    LayerMask previousLayerMask;
                    layer = SabreGUILayout.LayerMaskField(new GUIContent("Layer Mask", "The layer mask to limit the effects of the physics volume to specific layers."), (previousLayerMask = layer).value);
                    if (previousLayerMask != layer)
                    {
                        foreach (PhysicsVolume volume in physicsVolumes)
                        {
                            volume.layer = layer;
                        }
                        invalidate = true;
                    }

                    bool previousBoolean;
                    useFilterTag = UnityEditor.EditorGUILayout.Toggle(new GUIContent("Use Filter Tag", "Whether to use a filter tag."), previousBoolean = useFilterTag);
                    if (useFilterTag != previousBoolean)
                    {
                        foreach (PhysicsVolume volume in physicsVolumes)
                        {
                            volume.useFilterTag = useFilterTag;
                        }
                        invalidate = true;
                    }

                    if (useFilterTag)
                    {
                        string previousString;
                        filterTag = UnityEditor.EditorGUILayout.TagField(new GUIContent("Filter Tag", "The filter tag to limit the effects of the physics volume to specific tags."), previousString = filterTag);
                        if (filterTag != previousString)
                        {
                            foreach (PhysicsVolume volume in physicsVolumes)
                            {
                                volume.filterTag = filterTag;
                            }
                            invalidate = true;
                        }
                    }

                    PhysicsVolumeGravityMode previousPhysicsVolumeGravityMode;
                    gravity = (PhysicsVolumeGravityMode)UnityEditor.EditorGUILayout.EnumPopup(new GUIContent("Gravity", "The gravity settings applied to rigid bodies inside the volume."), previousPhysicsVolumeGravityMode = gravity);
                    if (previousPhysicsVolumeGravityMode != gravity)
                    {
                        foreach (PhysicsVolume volume in physicsVolumes)
                        {
                            volume.gravity = gravity;
                        }
                        invalidate = true;
                    }
                }
                GUILayout.EndVertical();
                UnityEditor.EditorGUI.indentLevel = 0;
            }
            GUILayout.EndVertical();

            return(invalidate); // true when a property changed, the brush invalidates and stores all changes.
        }
        public override bool OnInspectorGUI(Volume[] selectedVolumes)
        {
            var  reverbVolumes = selectedVolumes.Cast <ReverbVolume>();
            bool invalidate    = false;

            GUILayout.BeginVertical("Box");
            {
                GUILayout.Label("Volume", EditorStyles.boldLabel);

                EditorGUI.indentLevel = 1;

                LayerMask previousLayerMask;
                layer = SabreGUILayout.LayerMaskField(GUILabels.Layer, (previousLayerMask = layer).value);
                if (previousLayerMask != layer)
                {
                    foreach (ReverbVolume volume in reverbVolumes)
                    {
                        volume.layer = layer;
                    }
                    invalidate = true;
                }

                EditorGUI.indentLevel = 0;
            }
            GUILayout.EndVertical();
            GUILayout.BeginVertical("Box");
            {
                GUILayout.Label("Reverb Zone", EditorStyles.boldLabel);

                EditorGUI.indentLevel = 1;

                int oldRoom;
                room = EditorGUILayout.IntSlider(GUILabels.Room, oldRoom = room, -10000, 0);
                if (oldRoom != room)
                {
                    foreach (ReverbVolume volume in reverbVolumes)
                    {
                        volume.room = room;
                    }

                    invalidate = true;
                }

                int oldRoomHF;
                roomHF = EditorGUILayout.IntSlider(GUILabels.RoomHF, oldRoomHF = roomHF, -10000, 0);
                if (oldRoomHF != roomHF)
                {
                    foreach (ReverbVolume volume in reverbVolumes)
                    {
                        volume.roomHF = roomHF;
                    }

                    invalidate = true;
                }

                int oldRoomLF;
                roomLF = EditorGUILayout.IntSlider(GUILabels.RoomLF, oldRoomLF = roomLF, -10000, 0);
                if (oldRoomLF != roomLF)
                {
                    foreach (ReverbVolume volume in reverbVolumes)
                    {
                        volume.roomLF = roomLF;
                    }

                    invalidate = true;
                }

                float oldDecayTime;
                decayTime = EditorGUILayout.Slider(GUILabels.DecayTime, oldDecayTime = decayTime, 0.1f, 20f);
                if (oldDecayTime != decayTime)
                {
                    foreach (ReverbVolume volume in reverbVolumes)
                    {
                        volume.decayTime = decayTime;
                    }

                    invalidate = true;
                }

                float oldDecayHFRatio;
                decayHFRatio = EditorGUILayout.Slider(GUILabels.DecayHFRatio, oldDecayHFRatio = decayHFRatio, 0.1f, 2f);
                if (oldDecayHFRatio != decayHFRatio)
                {
                    foreach (ReverbVolume volume in reverbVolumes)
                    {
                        volume.decayHFRatio = decayHFRatio;
                    }

                    invalidate = true;
                }

                int oldReflections;
                reflections = EditorGUILayout.IntSlider(GUILabels.Reflections, oldReflections = reflections, -10000, 1000);
                if (oldReflections != reflections)
                {
                    foreach (ReverbVolume volume in reverbVolumes)
                    {
                        volume.reflections = reflections;
                    }

                    invalidate = true;
                }

                float oldReflectionsDelay;
                reflectionsDelay = EditorGUILayout.Slider(GUILabels.ReflectionsDelay, oldReflectionsDelay = reflectionsDelay, 0f, 0.3f);
                if (oldReflectionsDelay != reflectionsDelay)
                {
                    foreach (ReverbVolume volume in reverbVolumes)
                    {
                        volume.reflectionsDelay = reflectionsDelay;
                    }

                    invalidate = true;
                }

                int oldReverb;
                reverb = EditorGUILayout.IntSlider(GUILabels.Reverb, oldReverb = reverb, -10000, 2000);
                if (oldReverb != reverb)
                {
                    foreach (ReverbVolume volume in reverbVolumes)
                    {
                        volume.reverb = reverb;
                    }

                    invalidate = true;
                }

                float oldReverbDelay;
                reverbDelay = EditorGUILayout.Slider(GUILabels.ReverbDelay, oldReverbDelay = reverbDelay, 0f, 0.1f);
                if (oldReverbDelay != reverbDelay)
                {
                    foreach (ReverbVolume volume in reverbVolumes)
                    {
                        volume.room = room;
                    }

                    invalidate = true;
                }

                float oldHFReference;
                hfReference = EditorGUILayout.Slider(GUILabels.HFReference, oldHFReference = hfReference, 1000f, 20000f);
                if (oldHFReference != hfReference)
                {
                    foreach (ReverbVolume volume in reverbVolumes)
                    {
                        volume.hfReference = hfReference;
                    }

                    invalidate = true;
                }

                float oldLFReference;
                lfReference = EditorGUILayout.Slider(GUILabels.LFReference, oldLFReference = lfReference, 20f, 1000f);
                if (oldLFReference != lfReference)
                {
                    foreach (ReverbVolume volume in reverbVolumes)
                    {
                        volume.lfReference = lfReference;
                    }

                    invalidate = true;
                }

                float oldDiffusion;
                diffusion = EditorGUILayout.Slider(GUILabels.Diffusion, oldDiffusion = diffusion, 0f, 100f);
                if (oldDiffusion != diffusion)
                {
                    foreach (ReverbVolume volume in reverbVolumes)
                    {
                        volume.diffusion = diffusion;
                    }

                    invalidate = true;
                }

                float oldDensity;
                density = EditorGUILayout.Slider(GUILabels.Density, oldDensity = density, 0f, 100f);
                if (oldDensity != density)
                {
                    foreach (ReverbVolume volume in reverbVolumes)
                    {
                        volume.density = density;
                    }

                    invalidate = true;
                }

                EditorGUI.indentLevel = 0;
            }
            GUILayout.EndVertical();

            return(invalidate);
        }
예제 #4
0
        /// <summary>
        /// Called when the inspector GUI is drawn in the editor.
        /// </summary>
        /// <param name="selectedVolumes">The selected volumes in the editor (for multi-editing).</param>
        /// <returns>True if a property changed or else false.</returns>
        public override bool OnInspectorGUI(Volume[] selectedVolumes)
        {
            var  triggerVolumes = selectedVolumes.Cast <TriggerVolume>();
            bool invalidate     = false;

            GUILayout.BeginVertical("Box");
            {
                UnityEditor.EditorGUILayout.LabelField("Trigger Options", UnityEditor.EditorStyles.boldLabel);
                GUILayout.Space(4);

                UnityEditor.EditorGUI.indentLevel = 1;

                GUILayout.BeginVertical();
                {
                    // this is hidden so that we can introduce more trigger types in the future.

                    //TriggerVolumeTriggerType previousVolumeEventType;
                    //triggerType = (TriggerVolumeTriggerType)UnityEditor.EditorGUILayout.EnumPopup(new GUIContent("Trigger Type"), previousVolumeEventType = triggerType);
                    //if (triggerType != previousVolumeEventType)
                    //{
                    //    foreach (TriggerVolume volume in triggerVolumes)
                    //        volume.triggerType = triggerType;
                    //    invalidate = true;
                    //}

                    LayerMask previousLayerMask;
                    layer = SabreGUILayout.LayerMaskField(new GUIContent("Layer Mask", "The layer mask to limit the colliders that can invoke the trigger."), (previousLayerMask = layer).value);
                    if (previousLayerMask != layer)
                    {
                        foreach (TriggerVolume volume in triggerVolumes)
                        {
                            volume.layer = layer;
                        }
                        invalidate = true;
                    }

                    bool previousUseFilterTag;
                    useFilterTag = UnityEditor.EditorGUILayout.Toggle(new GUIContent("Use Filter Tag", "Whether to use a filter tag."), previousUseFilterTag = useFilterTag);
                    if (useFilterTag != previousUseFilterTag)
                    {
                        foreach (TriggerVolume volume in triggerVolumes)
                        {
                            volume.useFilterTag = useFilterTag;
                        }
                        invalidate = true;
                    }

                    if (useFilterTag)
                    {
                        string previousFilterTag;
                        filterTag = UnityEditor.EditorGUILayout.TagField(new GUIContent("Filter Tag", "The filter tag to limit the colliders that can invoke the trigger."), previousFilterTag = filterTag);
                        if (filterTag != previousFilterTag)
                        {
                            foreach (TriggerVolume volume in triggerVolumes)
                            {
                                volume.filterTag = filterTag;
                            }
                            invalidate = true;
                        }
                    }

                    bool previousTriggerOnce;
                    triggerOnceOnly = UnityEditor.EditorGUILayout.Toggle(new GUIContent("Trigger Once Only", "Whether the trigger can only be instigated once."), previousTriggerOnce = triggerOnceOnly);
                    if (triggerOnceOnly != previousTriggerOnce)
                    {
                        foreach (TriggerVolume volume in triggerVolumes)
                        {
                            volume.triggerOnceOnly = triggerOnceOnly;
                        }
                        invalidate = true;
                    }
                }
                GUILayout.EndVertical();

                UnityEditor.EditorGUI.indentLevel = 0;
            }
            GUILayout.EndVertical();

            GUILayout.BeginVertical("Box");
            {
                UnityEditor.EditorGUILayout.LabelField("Trigger Events", UnityEditor.EditorStyles.boldLabel);
                GUILayout.Space(4);

                if (triggerType == TriggerVolumeTriggerType.UnityEvent)
                {
                    UnityEditor.EditorGUI.indentLevel = 1;

                    GUILayout.BeginVertical();
                    {
                        UnityEditor.SerializedObject   tv    = new UnityEditor.SerializedObject(this);
                        UnityEditor.SerializedProperty prop1 = tv.FindProperty("onEnterEvent");
                        UnityEditor.SerializedProperty prop2 = tv.FindProperty("onStayEvent");
                        UnityEditor.SerializedProperty prop3 = tv.FindProperty("onExitEvent");

                        UnityEditor.EditorGUI.BeginChangeCheck();

                        UnityEditor.EditorGUILayout.PropertyField(prop1);
                        UnityEditor.EditorGUILayout.PropertyField(prop2);
                        UnityEditor.EditorGUILayout.PropertyField(prop3);

                        if (UnityEditor.EditorGUI.EndChangeCheck())
                        {
                            tv.ApplyModifiedProperties();
                            foreach (TriggerVolume volume in triggerVolumes)
                            {
                                volume.onEnterEvent = onEnterEvent;
                                volume.onStayEvent  = onStayEvent;
                                volume.onExitEvent  = onExitEvent;
                            }
                            invalidate = true;
                        }
                    }
                    GUILayout.EndVertical();

                    UnityEditor.EditorGUI.indentLevel = 0;
                }
            }
            GUILayout.EndVertical();

            return(invalidate);
        }
        public override bool OnInspectorGUI(Volume[] selectedVolumes)
        {
            System.Collections.Generic.IEnumerable <ReflectionProbeVolume> rpVolumes = selectedVolumes.Cast <ReflectionProbeVolume>();
            bool invalidate = false;

            GUILayout.Label("Reflection Probe", "OL Title");

            GUILayout.BeginVertical();
            {
                EditorGUI.indentLevel = 1;

                GUILayout.BeginVertical("grey_border");
                {
                    GUILayout.Space(4);

                    EditorGUILayout.LabelField("General Settings", EditorStyles.boldLabel);
                    ReflectionProbeMode oldType;
                    type = (ReflectionProbeMode)EditorGUILayout.EnumPopup("Type", oldType = type);
                    if (oldType != type)
                    {
                        foreach (ReflectionProbeVolume volume in rpVolumes)
                        {
                            volume.type = type;
                        }

                        invalidate = true;
                    }

                    if (type == ReflectionProbeMode.Custom)
                    {
                        EditorGUILayout.HelpBox("Editing custom probes is currently not supported by volumes. This can be set manually on the volume component.", MessageType.Info);

                        /*
                         *  bool oldDynamicObjects;
                         *  dynamicObjects = EditorGUILayout.Toggle( new GUIContent( "Dynamic Objects" ), oldDynamicObjects = dynamicObjects );
                         *  if( oldDynamicObjects != dynamicObjects )
                         *  {
                         *      foreach( ReflectionProbeVolume volume in rpVolumes )
                         *          volume.dynamicObjects = dynamicObjects;
                         *
                         *      invalidate = true;
                         *  }
                         *
                         *  Cubemap oldCustomCube;
                         *  customCube = (Cubemap)EditorGUILayout.ObjectField( "Custom Cube", oldCustomCube = customCube, typeof( Cubemap ), false );
                         *  if( oldCustomCube != customCube )
                         *  {
                         *      foreach( ReflectionProbeVolume volume in rpVolumes )
                         *          volume.customCube = customCube;
                         *
                         *      invalidate = true;
                         *  }
                         */
                    }

                    if (type == ReflectionProbeMode.Realtime)
                    {
                        EditorGUI.indentLevel = 2;
                        ReflectionProbeRefreshMode oldRefreshMode;
                        refreshMode = (ReflectionProbeRefreshMode)EditorGUILayout.EnumPopup("Refresh Mode", oldRefreshMode = refreshMode);
                        if (oldRefreshMode != refreshMode)
                        {
                            foreach (ReflectionProbeVolume volume in rpVolumes)
                            {
                                volume.refreshMode = refreshMode;
                            }

                            invalidate = true;
                        }

                        ReflectionProbeTimeSlicingMode oldTimeMode;
                        timeMode = (ReflectionProbeTimeSlicingMode)EditorGUILayout.EnumPopup("Time Slicing", oldTimeMode = timeMode);
                        if (oldTimeMode != timeMode)
                        {
                            foreach (ReflectionProbeVolume volume in rpVolumes)
                            {
                                volume.timeMode = timeMode;
                            }

                            invalidate = true;
                        }
                        EditorGUI.indentLevel = 1;
                    }

                    GUILayout.Space(4);
                }
                GUILayout.EndVertical();

                GUILayout.BeginVertical("grey_border");
                {
                    GUILayout.Space(4);
                    EditorGUILayout.LabelField("Runtime Settings", EditorStyles.boldLabel);

                    int oldImportance;
                    importance = EditorGUILayout.IntField("Importance", oldImportance = importance);
                    if (oldImportance != importance)
                    {
                        foreach (ReflectionProbeVolume volume in rpVolumes)
                        {
                            volume.importance = importance;
                        }

                        invalidate = true;
                    }

                    float oldIntensity;
                    intensity = EditorGUILayout.FloatField("Intensity", oldIntensity = intensity);
                    if (oldIntensity != intensity)
                    {
                        foreach (ReflectionProbeVolume volume in rpVolumes)
                        {
                            volume.intensity = intensity;
                        }

                        invalidate = true;
                    }

                    bool oldBoxProj;
                    boxProjection = EditorGUILayout.Toggle("Box Projection", oldBoxProj = boxProjection);
                    if (oldBoxProj != boxProjection)
                    {
                        foreach (ReflectionProbeVolume volume in rpVolumes)
                        {
                            volume.boxProjection = boxProjection;
                        }

                        invalidate = true;
                    }

                    float oldBlendDist;
                    blendDistance = EditorGUILayout.FloatField("Blend Distance", oldBlendDist = blendDistance);
                    if (oldBlendDist != blendDistance)
                    {
                        foreach (ReflectionProbeVolume volume in rpVolumes)
                        {
                            volume.blendDistance = blendDistance;
                        }

                        invalidate = true;
                    }

                    EditorGUILayout.HelpBox("Size and origin is set by the volume", MessageType.Info);

                    GUILayout.Space(4);
                }
                GUILayout.EndVertical();

                GUILayout.BeginVertical("grey_border");
                {
                    GUILayout.Space(4);
                    EditorGUILayout.LabelField("Cubemap Capture Settings", EditorStyles.boldLabel);

                    ReflectionCubeResolution oldRes;
                    resolution = (ReflectionCubeResolution)EditorGUILayout.EnumPopup("Resolution", oldRes = resolution);
                    if (oldRes != resolution)
                    {
                        foreach (ReflectionProbeVolume volume in rpVolumes)
                        {
                            volume.resolution = resolution;
                        }

                        invalidate = true;
                    }

                    bool oldHDR;
                    hdr = EditorGUILayout.Toggle("HDR", oldHDR = hdr);
                    if (oldHDR != hdr)
                    {
                        foreach (ReflectionProbeVolume volume in rpVolumes)
                        {
                            volume.hdr = hdr;
                        }

                        invalidate = true;
                    }

                    float oldShadowDist;
                    shadowDist = EditorGUILayout.FloatField("Shadow Distance", oldShadowDist = shadowDist);
                    if (oldShadowDist != shadowDist)
                    {
                        foreach (ReflectionProbeVolume volume in rpVolumes)
                        {
                            volume.shadowDist = shadowDist;
                        }

                        invalidate = true;
                    }

                    ReflectionProbeClearFlags oldCFlags;
                    clearFlags = (ReflectionProbeClearFlags)EditorGUILayout.EnumPopup("Clear Flags", oldCFlags = clearFlags);
                    if (oldCFlags != clearFlags)
                    {
                        foreach (ReflectionProbeVolume volume in rpVolumes)
                        {
                            volume.clearFlags = clearFlags;
                        }

                        invalidate = true;
                    }

                    Color oldColor;
                    background = EditorGUILayout.ColorField("Background", oldColor = background);
                    if (oldColor != background)
                    {
                        foreach (ReflectionProbeVolume volume in rpVolumes)
                        {
                            volume.background = background;
                        }

                        invalidate = true;
                    }

                    LayerMask oldMask;
                    cullingMask = SabreGUILayout.LayerMaskField(new GUIContent("Culling Mask"), oldMask = cullingMask);    //EditorGUILayout.MaskField( "Culling Mask", oldMask = cullingMask );
                    if (oldMask != cullingMask)
                    {
                        foreach (ReflectionProbeVolume volume in rpVolumes)
                        {
                            volume.cullingMask = cullingMask;
                        }

                        invalidate = true;
                    }

                    Vector2 oldClip;
                    clippingPlanes = EditorGUILayout.Vector2Field(new GUIContent("Clipping Planes", "X = Near, Y = Far"), oldClip = clippingPlanes);
                    if (oldClip != clippingPlanes)
                    {
                        foreach (ReflectionProbeVolume volume in rpVolumes)
                        {
                            volume.clippingPlanes = clippingPlanes;
                        }

                        invalidate = true;
                    }

                    EditorGUILayout.HelpBox("Occlusion is currently not supported by volumes. This can be set on the volume component.", MessageType.Info);

                    GUILayout.Space(4);
                }
                GUILayout.EndVertical();

                if (type == ReflectionProbeMode.Custom)
                {
                    EditorGUILayout.HelpBox("This probe is set to Custom, and is not handled by volumes.", MessageType.Info);
                }
                else if (type == ReflectionProbeMode.Realtime)
                {
                    EditorGUILayout.HelpBox("This probe is set to Realtime, and its baking is handled by unity. The results are stored in the GI Cache.", MessageType.Info);
                }

                EditorGUI.indentLevel = 0;
            }
            GUILayout.EndVertical();

            return(invalidate);
        }