Beispiel #1
0
 void OnEnable()
 {
     currentCollider = null;
     currentEffect   = null;
     if (baseEffect == null)
     {
         baseEffect = GetComponent <HighlightEffect> ();
         if (baseEffect == null)
         {
             baseEffect = gameObject.AddComponent <HighlightEffect> ();
         }
     }
     raycastCamera = GetComponent <Camera> ();
     if (raycastCamera == null)
     {
         raycastCamera = Camera.main;
         if (raycastCamera == null)
         {
             raycastCamera = FindObjectOfType <Camera> ();
             if (raycastCamera == null)
             {
                 Debug.LogError("Highlight Manager: no camera found!");
             }
         }
     }
 }
 public void Load(HighlightEffect effect)
 {
     effect.effectGroup           = effectGroup;
     effect.effectGroupLayer      = effectGroupLayer;
     effect.alphaCutOff           = alphaCutOff;
     effect.cullBackFaces         = cullBackFaces;
     effect.depthClip             = depthClip;
     effect.fadeInDuration        = fadeInDuration;
     effect.fadeOutDuration       = fadeOutDuration;
     effect.overlay               = overlay;
     effect.overlayColor          = overlayColor;
     effect.overlayAnimationSpeed = overlayAnimationSpeed;
     effect.overlayMinIntensity   = overlayMinIntensity;
     effect.overlayBlending       = overlayBlending;
     effect.outline               = outline;
     effect.outlineColor          = outlineColor;
     effect.outlineWidth          = outlineWidth;
     effect.outlineQuality        = outlineQuality;
     effect.outlineOptimalBlit    = outlineOptimalBlit;
     effect.outlineDownsampling   = outlineDownsampling;
     effect.outlineVisibility     = outlineVisibility;
     effect.outlineIndependent    = outlineIndependent;
     effect.glow                            = glow;
     effect.glowWidth                       = glowWidth;
     effect.glowQuality                     = glowQuality;
     effect.glowOptimalBlit                 = glowOptimalBlit;
     effect.glowDownsampling                = glowDownsampling;
     effect.glowHQColor                     = glowHQColor;
     effect.glowDithering                   = glowDithering;
     effect.glowMagicNumber1                = glowMagicNumber1;
     effect.glowMagicNumber2                = glowMagicNumber2;
     effect.glowAnimationSpeed              = glowAnimationSpeed;
     effect.glowVisibility                  = glowVisibility;
     effect.glowBlendMode                   = glowBlendMode;
     effect.glowPasses                      = GetGlowPassesCopy(glowPasses);
     effect.innerGlow                       = innerGlow;
     effect.innerGlowWidth                  = innerGlowWidth;
     effect.innerGlowColor                  = innerGlowColor;
     effect.innerGlowVisibility             = innerGlowVisibility;
     effect.targetFX                        = targetFX;
     effect.targetFXColor                   = targetFXColor;
     effect.targetFXEndScale                = targetFXEndScale;
     effect.targetFXInitialScale            = targetFXInitialScale;
     effect.targetFXRotationSpeed           = targetFXRotationSpeed;
     effect.targetFXStayDuration            = targetFXStayDuration;
     effect.targetFXTexture                 = targetFXTexture;
     effect.targetFXTransitionDuration      = targetFXTransitionDuration;
     effect.seeThrough                      = seeThrough;
     effect.seeThroughOccluderMask          = seeThroughOccluderMask;
     effect.seeThroughOccluderThreshold     = seeThroughOccluderThreshold;
     effect.seeThroughOccluderCheckInterval = seeThroughOccluderCheckInterval;
     effect.seeThroughIntensity             = seeThroughIntensity;
     effect.seeThroughTintAlpha             = seeThroughTintAlpha;
     effect.seeThroughTintColor             = seeThroughTintColor;
     effect.seeThroughNoise                 = seeThroughNoise;
     effect.seeThroughBorder                = seeThroughBorder;
     effect.seeThroughBorderColor           = seeThroughBorderColor;
     effect.seeThroughBorderWidth           = seeThroughBorderWidth;
     effect.UpdateMaterialProperties();
 }
            // Here you can implement the rendering logic.
            // Use <c>ScriptableRenderContext</c> to issue drawing commands or execute command buffers
            // https://docs.unity3d.com/ScriptReference/Rendering.ScriptableRenderContext.html
            // You don't have to call ScriptableRenderContext.submit, the render pipeline will call it at specific points in the pipeline.
            public override void Execute(ScriptableRenderContext context, ref RenderingData renderingData)
            {
                Camera cam = renderingData.cameraData.camera;

                RenderTargetIdentifier cameraColorTarget = renderer.cameraColorTarget;
                RenderTargetIdentifier cameraDepthTarget = renderer.cameraDepthTarget;

                if (!usesCameraOverlay && (cameraTextureDescriptor.msaaSamples > 1 || cam.cameraType == CameraType.SceneView))
                {
                    cameraDepthTarget = cameraColorTarget;
                }
                int count = HighlightEffect.instances.Count;

                for (int k = 0; k < count; k++)
                {
                    HighlightEffect effect = HighlightEffect.instances[k];
                    if (effect == null)
                    {
                        continue;
                    }
                    if (effect.isActiveAndEnabled)
                    {
                        CommandBuffer cb = effect.GetCommandBuffer(cam, cameraColorTarget, cameraDepthTarget);
                        if (cb != null)
                        {
                            context.ExecuteCommandBuffer(cb);
                        }
                    }
                }
            }
        void SwitchesCollider(Transform newObject)
        {
            if (currentEffect != null)
            {
                currentEffect.SetHighlighted(false);
                currentEffect = null;
            }
            currentObject = newObject;
            if (newObject == null)
            {
                return;
            }
            HighlightTrigger ht = newObject.GetComponent <HighlightTrigger>();

            if (ht != null && ht.enabled)
            {
                return;
            }

            HighlightEffect otherEffect = newObject.GetComponent <HighlightEffect> ();

            currentEffect = otherEffect != null ? otherEffect : baseEffect;
            currentEffect.SetTarget(currentObject.transform);
            currentEffect.SetHighlighted(true);
        }
 public void Save(HighlightEffect effect)
 {
     effectGroup           = effect.effectGroup;
     effectGroupLayer      = effect.effectGroupLayer;
     alphaCutOff           = effect.alphaCutOff;
     cullBackFaces         = effect.cullBackFaces;
     depthClip             = effect.depthClip;
     fadeInDuration        = effect.fadeInDuration;
     fadeOutDuration       = effect.fadeOutDuration;
     overlay               = effect.overlay;
     overlayColor          = effect.overlayColor;
     overlayAnimationSpeed = effect.overlayAnimationSpeed;
     overlayMinIntensity   = effect.overlayMinIntensity;
     overlayBlending       = effect.overlayBlending;
     outline               = effect.outline;
     outlineColor          = effect.outlineColor;
     outlineWidth          = effect.outlineWidth;
     outlineQuality        = effect.outlineQuality;
     outlineDownsampling   = effect.outlineDownsampling;
     outlineVisibility     = effect.outlineVisibility;
     outlineIndependent    = effect.outlineIndependent;
     outlineOptimalBlit    = effect.outlineOptimalBlit;
     glow                            = effect.glow;
     glowWidth                       = effect.glowWidth;
     glowQuality                     = effect.glowQuality;
     glowOptimalBlit                 = effect.glowOptimalBlit;
     glowDownsampling                = effect.glowDownsampling;
     glowHQColor                     = effect.glowHQColor;
     glowDithering                   = effect.glowDithering;
     glowMagicNumber1                = effect.glowMagicNumber1;
     glowMagicNumber2                = effect.glowMagicNumber2;
     glowAnimationSpeed              = effect.glowAnimationSpeed;
     glowVisibility                  = effect.glowVisibility;
     glowBlendMode                   = effect.glowBlendMode;
     glowPasses                      = GetGlowPassesCopy(effect.glowPasses);
     innerGlow                       = effect.innerGlow;
     innerGlowWidth                  = effect.innerGlowWidth;
     innerGlowColor                  = effect.innerGlowColor;
     innerGlowVisibility             = effect.innerGlowVisibility;
     targetFX                        = effect.targetFX;
     targetFXColor                   = effect.targetFXColor;
     targetFXEndScale                = effect.targetFXEndScale;
     targetFXInitialScale            = effect.targetFXInitialScale;
     targetFXRotationSpeed           = effect.targetFXRotationSpeed;
     targetFXStayDuration            = effect.targetFXStayDuration;
     targetFXTexture                 = effect.targetFXTexture;
     targetFXTransitionDuration      = effect.targetFXTransitionDuration;
     seeThrough                      = effect.seeThrough;
     seeThroughOccluderMask          = effect.seeThroughOccluderMask;
     seeThroughOccluderThreshold     = effect.seeThroughOccluderThreshold;
     seeThroughOccluderCheckInterval = effect.seeThroughOccluderCheckInterval;
     seeThroughIntensity             = effect.seeThroughIntensity;
     seeThroughTintAlpha             = effect.seeThroughTintAlpha;
     seeThroughTintColor             = effect.seeThroughTintColor;
     seeThroughNoise                 = effect.seeThroughNoise;
     seeThroughBorder                = effect.seeThroughBorder;
     seeThroughBorderColor           = effect.seeThroughBorderColor;
     seeThroughBorderWidth           = effect.seeThroughBorderWidth;
 }
Beispiel #6
0
 public void Load(HighlightEffect effect)
 {
     effect.effectGroup           = effectGroup;
     effect.effectGroupLayer      = effectGroupLayer;
     effect.effectNameFilter      = effectNameFilter;
     effect.combineMeshes         = combineMeshes;
     effect.alphaCutOff           = alphaCutOff;
     effect.cullBackFaces         = cullBackFaces;
     effect.normalsOption         = normalsOption;
     effect.fadeInDuration        = fadeInDuration;
     effect.fadeOutDuration       = fadeOutDuration;
     effect.constantWidth         = constantWidth;
     effect.overlay               = overlay;
     effect.overlayColor          = overlayColor;
     effect.overlayAnimationSpeed = overlayAnimationSpeed;
     effect.overlayMinIntensity   = overlayMinIntensity;
     effect.overlayBlending       = overlayBlending;
     effect.outline               = outline;
     effect.outlineColor          = outlineColor;
     effect.outlineWidth          = outlineWidth;
     effect.outlineQuality        = outlineQuality;
     effect.outlineDownsampling   = outlineDownsampling;
     effect.outlineVisibility     = outlineVisibility;
     effect.outlineIndependent    = outlineIndependent;
     effect.glow                       = glow;
     effect.glowWidth                  = glowWidth;
     effect.glowQuality                = glowQuality;
     effect.glowDownsampling           = glowDownsampling;
     effect.glowHQColor                = glowHQColor;
     effect.glowDithering              = glowDithering;
     effect.glowMagicNumber1           = glowMagicNumber1;
     effect.glowMagicNumber2           = glowMagicNumber2;
     effect.glowAnimationSpeed         = glowAnimationSpeed;
     effect.glowVisibility             = glowVisibility;
     effect.glowBlendPasses            = glowBlendPasses;
     effect.glowPasses                 = GetGlowPassesCopy(glowPasses);
     effect.innerGlow                  = innerGlow;
     effect.innerGlowWidth             = innerGlowWidth;
     effect.innerGlowColor             = innerGlowColor;
     effect.innerGlowVisibility        = innerGlowVisibility;
     effect.targetFX                   = targetFX;
     effect.targetFXColor              = targetFXColor;
     effect.targetFXEndScale           = targetFXEndScale;
     effect.targetFXInitialScale       = targetFXInitialScale;
     effect.targetFXRotationSpeed      = targetFXRotationSpeed;
     effect.targetFXStayDuration       = targetFXStayDuration;
     effect.targetFXTexture            = targetFXTexture;
     effect.targetFXTransitionDuration = targetFXTransitionDuration;
     effect.seeThrough                 = seeThrough;
     effect.seeThroughIntensity        = seeThroughIntensity;
     effect.seeThroughTintAlpha        = seeThroughTintAlpha;
     effect.seeThroughTintColor        = seeThroughTintColor;
     effect.seeThroughNoise            = seeThroughNoise;
     effect.seeThroughBorder           = seeThroughBorder;
     effect.seeThroughBorderColor      = seeThroughBorderColor;
     effect.seeThroughBorderWidth      = seeThroughBorderWidth;
 }
Beispiel #7
0
 public void Save(HighlightEffect effect)
 {
     effectGroup           = effect.effectGroup;
     effectGroupLayer      = effect.effectGroupLayer;
     effectNameFilter      = effect.effectNameFilter;
     combineMeshes         = effect.combineMeshes;
     alphaCutOff           = effect.alphaCutOff;
     cullBackFaces         = effect.cullBackFaces;
     normalsOption         = effect.normalsOption;
     fadeInDuration        = effect.fadeInDuration;
     fadeOutDuration       = effect.fadeOutDuration;
     constantWidth         = effect.constantWidth;
     overlay               = effect.overlay;
     overlayColor          = effect.overlayColor;
     overlayAnimationSpeed = effect.overlayAnimationSpeed;
     overlayMinIntensity   = effect.overlayMinIntensity;
     overlayBlending       = effect.overlayBlending;
     outline               = effect.outline;
     outlineColor          = effect.outlineColor;
     outlineWidth          = effect.outlineWidth;
     outlineQuality        = effect.outlineQuality;
     outlineDownsampling   = effect.outlineDownsampling;
     outlineVisibility     = effect.outlineVisibility;
     outlineIndependent    = effect.outlineIndependent;
     glow                       = effect.glow;
     glowWidth                  = effect.glowWidth;
     glowQuality                = effect.glowQuality;
     glowDownsampling           = effect.glowDownsampling;
     glowHQColor                = effect.glowHQColor;
     glowDithering              = effect.glowDithering;
     glowMagicNumber1           = effect.glowMagicNumber1;
     glowMagicNumber2           = effect.glowMagicNumber2;
     glowAnimationSpeed         = effect.glowAnimationSpeed;
     glowVisibility             = effect.glowVisibility;
     glowBlendPasses            = effect.glowBlendPasses;
     glowPasses                 = GetGlowPassesCopy(effect.glowPasses);
     innerGlow                  = effect.innerGlow;
     innerGlowWidth             = effect.innerGlowWidth;
     innerGlowColor             = effect.innerGlowColor;
     innerGlowVisibility        = effect.innerGlowVisibility;
     targetFX                   = effect.targetFX;
     targetFXColor              = effect.targetFXColor;
     targetFXEndScale           = effect.targetFXEndScale;
     targetFXInitialScale       = effect.targetFXInitialScale;
     targetFXRotationSpeed      = effect.targetFXRotationSpeed;
     targetFXStayDuration       = effect.targetFXStayDuration;
     targetFXTexture            = effect.targetFXTexture;
     targetFXTransitionDuration = effect.targetFXTransitionDuration;
     seeThrough                 = effect.seeThrough;
     seeThroughIntensity        = effect.seeThroughIntensity;
     seeThroughTintAlpha        = effect.seeThroughTintAlpha;
     seeThroughTintColor        = effect.seeThroughTintColor;
     seeThroughNoise            = effect.seeThroughNoise;
     seeThroughBorder           = effect.seeThroughBorder;
     seeThroughBorderColor      = effect.seeThroughBorderColor;
     seeThroughBorderWidth      = effect.seeThroughBorderWidth;
 }
        public override void OnInspectorGUI()
        {
            HighlightEffect thisEffect   = (HighlightEffect)target;
            bool            isNotManager = thisEffect.GetComponent <HighlightManager> () == null;

            EditorGUILayout.Separator();
            serializedObject.Update();
            if (isNotManager)
            {
                EditorGUILayout.PropertyField(previewInEditor);
            }
            EditorGUILayout.Separator();
            EditorGUILayout.LabelField("Highlight Options", EditorStyles.boldLabel);
            EditorGUI.BeginChangeCheck();
            if (isNotManager)
            {
                EditorGUILayout.PropertyField(highlighted);
            }
            EditorGUILayout.PropertyField(overlay);
            EditorGUILayout.PropertyField(overlayColor, new GUIContent("   Color"));
            EditorGUILayout.PropertyField(overlayAnimationSpeed, new GUIContent("   Animation Speed"));
            EditorGUILayout.PropertyField(outline);
            EditorGUILayout.PropertyField(outlineWidth, new GUIContent("   Width"));
            EditorGUILayout.PropertyField(outlineColor, new GUIContent("   Color"));
            EditorGUILayout.PropertyField(glow);
            EditorGUILayout.PropertyField(glowWidth, new GUIContent("   Width"));
            EditorGUILayout.PropertyField(glowAnimationSpeed, new GUIContent("   Animation Speed"));
            EditorGUILayout.PropertyField(glowDithering, new GUIContent("   Dithering"));
            if (glowDithering.boolValue)
            {
                EditorGUILayout.PropertyField(glowMagicNumber1, new GUIContent("   Magic Number 1"));
                EditorGUILayout.PropertyField(glowMagicNumber2, new GUIContent("   Magic Number 2"));
            }
            EditorGUILayout.PropertyField(glowPasses, true);
            EditorGUILayout.Separator();
            EditorGUILayout.LabelField("See-Through Options", EditorStyles.boldLabel);
            EditorGUILayout.PropertyField(seeThrough);
            EditorGUILayout.PropertyField(seeThroughIntensity, new GUIContent("   Intensity"));
            EditorGUILayout.PropertyField(seeThroughTintAlpha, new GUIContent("   Alpha"));
            EditorGUILayout.PropertyField(seeThroughTintColor, new GUIContent("   Color"));

            if (serializedObject.ApplyModifiedProperties())
            {
                foreach (HighlightEffect effect in targets)
                {
                    effect.Refresh();
                }
            }
            HighlightEffect _effect = (HighlightEffect)target;

            if (_effect != null && _effect.previewInEditor)
            {
                EditorUtility.SetDirty(_effect);
            }
        }
Beispiel #9
0
        void Highlight(bool state)
        {
            HighlightEffect hb = transform.GetComponent <HighlightEffect> ();

            if (hb == null && state)
            {
                hb = gameObject.AddComponent <HighlightEffect> ();
            }
            if (hb != null)
            {
                hb.SetHighlighted(state);
            }
        }
Beispiel #10
0
		void OnEnable () {
			profile = serializedObject.FindProperty ("profile");
			profileSync = serializedObject.FindProperty ("profileSync");
			ignoreObjectVisibility = serializedObject.FindProperty ("ignoreObjectVisibility");
			ignore = serializedObject.FindProperty ("ignore");
			previewInEditor = serializedObject.FindProperty ("previewInEditor");
			highlighted = serializedObject.FindProperty ("_highlighted");
			fadeInDuration = serializedObject.FindProperty ("fadeInDuration");
			fadeOutDuration = serializedObject.FindProperty ("fadeOutDuration");
			overlay = serializedObject.FindProperty ("overlay");
			overlayColor = serializedObject.FindProperty ("overlayColor");
			overlayAnimationSpeed = serializedObject.FindProperty ("overlayAnimationSpeed");
			overlayMinIntensity = serializedObject.FindProperty ("overlayMinIntensity");
			overlayBlending = serializedObject.FindProperty ("overlayBlending");
			outline = serializedObject.FindProperty ("outline");
			outlineColor = serializedObject.FindProperty ("outlineColor");
			outlineWidth = serializedObject.FindProperty ("outlineWidth");
			outlineHQ = serializedObject.FindProperty ("outlineHQ");
			outlineAlwaysOnTop = serializedObject.FindProperty ("outlineAlwaysOnTop");
			outlineCullBackFaces = serializedObject.FindProperty ("outlineCullBackFaces");
			glow = serializedObject.FindProperty ("glow");
			glowWidth = serializedObject.FindProperty ("glowWidth");
			glowHQ = serializedObject.FindProperty ("glowHQ");
			glowAnimationSpeed = serializedObject.FindProperty ("glowAnimationSpeed");
			glowDithering = serializedObject.FindProperty ("glowDithering");
			glowMagicNumber1 = serializedObject.FindProperty ("glowMagicNumber1");
			glowMagicNumber2 = serializedObject.FindProperty ("glowMagicNumber2");
			glowAnimationSpeed = serializedObject.FindProperty ("glowAnimationSpeed");
			glowPasses = serializedObject.FindProperty ("glowPasses");
			glowAlwaysOnTop = serializedObject.FindProperty ("glowAlwaysOnTop");
			glowCullBackFaces = serializedObject.FindProperty ("glowCullBackFaces");
			innerGlow = serializedObject.FindProperty ("innerGlow");
			innerGlowColor = serializedObject.FindProperty ("innerGlowColor");
			innerGlowWidth = serializedObject.FindProperty ("innerGlowWidth");
			innerGlowAlwaysOnTop = serializedObject.FindProperty ("innerGlowAlwaysOnTop");
			seeThrough = serializedObject.FindProperty ("seeThrough");
			seeThroughIntensity = serializedObject.FindProperty ("seeThroughIntensity");
			seeThroughTintAlpha = serializedObject.FindProperty ("seeThroughTintAlpha");
			seeThroughTintColor = serializedObject.FindProperty ("seeThroughTintColor");
			targetFX = serializedObject.FindProperty ("targetFX");
			targetFXTexture = serializedObject.FindProperty ("targetFXTexture");
			targetFXRotationSpeed = serializedObject.FindProperty ("targetFXRotationSpeed");
			targetFXInitialScale = serializedObject.FindProperty ("targetFXInitialScale");
			targetFXEndScale = serializedObject.FindProperty ("targetFXEndScale");
			targetFXColor = serializedObject.FindProperty ("targetFXColor");
			targetFXCenter = serializedObject.FindProperty ("targetFXCenter");
			targetFXTransitionDuration = serializedObject.FindProperty ("targetFXTransitionDuration");
			targetFXStayDuration = serializedObject.FindProperty ("targetFXStayDuration");
			thisEffect = (HighlightEffect)target;
			thisEffect.Refresh ();
		}
Beispiel #11
0
 public void Load(HighlightEffect effect)
 {
     effect.effectGroup           = effectGroup;
     effect.effectGroupLayer      = effectGroupLayer;
     effect.alphaCutOff           = alphaCutOff;
     effect.cullBackFaces         = cullBackFaces;
     effect.fadeInDuration        = fadeInDuration;
     effect.fadeOutDuration       = fadeOutDuration;
     effect.overlay               = overlay;
     effect.overlayColor          = overlayColor;
     effect.overlayAnimationSpeed = overlayAnimationSpeed;
     effect.overlayMinIntensity   = overlayMinIntensity;
     effect.overlayBlending       = overlayBlending;
     effect.outline               = outline;
     effect.outlineColor          = outlineColor;
     effect.outlineWidth          = outlineWidth;
     effect.outlineQuality        = outlineQuality;
     effect.outlineAlwaysOnTop    = outlineAlwaysOnTop;
     effect.glow                       = glow;
     effect.glowWidth                  = glowWidth;
     effect.glowQuality                = glowQuality;
     effect.glowHQColor                = glowHQColor;
     effect.glowDithering              = glowDithering;
     effect.glowMagicNumber1           = glowMagicNumber1;
     effect.glowMagicNumber2           = glowMagicNumber2;
     effect.glowAnimationSpeed         = glowAnimationSpeed;
     effect.glowAlwaysOnTop            = glowAlwaysOnTop;
     effect.glowPasses                 = GetGlowPassesCopy(glowPasses);
     effect.innerGlow                  = innerGlow;
     effect.innerGlowWidth             = innerGlowWidth;
     effect.innerGlowColor             = innerGlowColor;
     effect.innerGlowAlwaysOnTop       = innerGlowAlwaysOnTop;
     effect.targetFX                   = targetFX;
     effect.targetFXColor              = targetFXColor;
     effect.targetFXEndScale           = targetFXEndScale;
     effect.targetFXInitialScale       = targetFXInitialScale;
     effect.targetFXRotationSpeed      = targetFXRotationSpeed;
     effect.targetFXStayDuration       = targetFXStayDuration;
     effect.targetFXTexture            = targetFXTexture;
     effect.targetFXTransitionDuration = targetFXTransitionDuration;
     effect.seeThrough                 = seeThrough;
     effect.seeThroughIntensity        = seeThroughIntensity;
     effect.seeThroughTintAlpha        = seeThroughTintAlpha;
     effect.seeThroughTintColor        = seeThroughTintColor;
 }
Beispiel #12
0
 public void Save(HighlightEffect effect)
 {
     effectGroup           = effect.effectGroup;
     effectGroupLayer      = effect.effectGroupLayer;
     alphaCutOff           = effect.alphaCutOff;
     cullBackFaces         = effect.cullBackFaces;
     fadeInDuration        = effect.fadeInDuration;
     fadeOutDuration       = effect.fadeOutDuration;
     overlay               = effect.overlay;
     overlayColor          = effect.overlayColor;
     overlayAnimationSpeed = effect.overlayAnimationSpeed;
     overlayMinIntensity   = effect.overlayMinIntensity;
     overlayBlending       = effect.overlayBlending;
     outline               = effect.outline;
     outlineColor          = effect.outlineColor;
     outlineWidth          = effect.outlineWidth;
     outlineQuality        = effect.outlineQuality;
     outlineAlwaysOnTop    = effect.outlineAlwaysOnTop;
     glow                       = effect.glow;
     glowWidth                  = effect.glowWidth;
     glowQuality                = effect.glowQuality;
     glowHQColor                = effect.glowHQColor;
     glowDithering              = effect.glowDithering;
     glowMagicNumber1           = effect.glowMagicNumber1;
     glowMagicNumber2           = effect.glowMagicNumber2;
     glowAnimationSpeed         = effect.glowAnimationSpeed;
     glowAlwaysOnTop            = effect.glowAlwaysOnTop;
     glowPasses                 = GetGlowPassesCopy(effect.glowPasses);
     innerGlow                  = effect.innerGlow;
     innerGlowWidth             = effect.innerGlowWidth;
     innerGlowColor             = effect.innerGlowColor;
     innerGlowAlwaysOnTop       = effect.innerGlowAlwaysOnTop;
     targetFX                   = effect.targetFX;
     targetFXColor              = effect.targetFXColor;
     targetFXEndScale           = effect.targetFXEndScale;
     targetFXInitialScale       = effect.targetFXInitialScale;
     targetFXRotationSpeed      = effect.targetFXRotationSpeed;
     targetFXStayDuration       = effect.targetFXStayDuration;
     targetFXTexture            = effect.targetFXTexture;
     targetFXTransitionDuration = effect.targetFXTransitionDuration;
     seeThrough                 = effect.seeThrough;
     seeThroughIntensity        = effect.seeThroughIntensity;
     seeThroughTintAlpha        = effect.seeThroughTintAlpha;
     seeThroughTintColor        = effect.seeThroughTintColor;
 }
Beispiel #13
0
        void SwitchesCollider(Collider newCollider)
        {
            if (currentEffect != null)
            {
                currentEffect.SetHighlighted(false);
            }
            currentCollider = newCollider;
            if (newCollider == null || newCollider.GetComponent <HighlightTrigger> () != null)
            {
                return;
            }

            HighlightEffect otherEffect = newCollider.GetComponent <HighlightEffect> ();

            currentEffect = otherEffect != null ? otherEffect : baseEffect;
            currentEffect.SetTarget(currentCollider.transform);
            currentEffect.SetHighlighted(true);
        }
Beispiel #14
0
        void Init()
        {
            if (detectionMethod == DetectionMethod.CapsuleCast)
            {
                HighlightEffect.RegisterOccluder(this);
                return;
            }

            if (rr == null)
            {
                rr = new List <Renderer>();
            }
            else
            {
                rr.Clear();
            }
            GetComponentsInChildren <Renderer>(rr);
            int rrCount = rr.Count;

            meshData = new MeshData[rrCount];
            for (int k = 0; k < rrCount; k++)
            {
                meshData[k].renderer     = rr[k];
                meshData[k].subMeshCount = 1;
                if (rr[k] is MeshRenderer)
                {
                    MeshFilter mf = rr[k].GetComponent <MeshFilter>();
                    if (mf != null && mf.sharedMesh != null)
                    {
                        meshData[k].subMeshCount = mf.sharedMesh.subMeshCount;
                    }
                }
                else if (rr[k] is SkinnedMeshRenderer)
                {
                    SkinnedMeshRenderer smr = (SkinnedMeshRenderer)rr[k];
                    meshData[k].subMeshCount = smr.sharedMesh.subMeshCount;
                }
            }
            if (rrCount > 0)
            {
                HighlightEffect.RegisterOccluder(this);
            }
        }
Beispiel #15
0
        void SwitchesCollider(Transform newObject)
        {
            if (currentEffect != null)
            {
                currentEffect.SetHighlighted(false);
                currentEffect = null;
            }
            currentObject = newObject;
            if (newObject == null)
            {
                return;
            }
            HighlightTrigger ht = newObject.GetComponent <HighlightTrigger>();

            if (ht != null && ht.enabled)
            {
                return;
            }

            HighlightEffect otherEffect = newObject.GetComponent <HighlightEffect> ();

            if (otherEffect == null)
            {
                // Check if there's a parent highlight effect that includes this object
                HighlightEffect parentEffect = newObject.GetComponentInParent <HighlightEffect>();
                if (parentEffect != null && parentEffect.Includes(newObject))
                {
                    currentEffect = parentEffect;
                    currentEffect.SetHighlighted(true);
                    return;
                }
            }
            currentEffect = otherEffect != null ? otherEffect : baseEffect;
            currentEffect.SetTarget(currentObject);
            currentEffect.SetHighlighted(true);
        }
Beispiel #16
0
 void OnDisable()
 {
     HighlightEffect.UnregisterOccluder(this);
 }
 void Awake()
 {
     effect = GetComponent <HighlightEffect> ();
 }
        public override void OnInspectorGUI()
        {
            EditorGUILayout.Separator();

            // URP setup helpers
            pipe = GraphicsSettings.currentRenderPipeline as UniversalRenderPipelineAsset;
            if (pipe == null)
            {
                EditorGUILayout.HelpBox("You must assign the Universal Rendering Pipeline asset in Project Settings / Graphics. Then, add the Highlight Plus Scriptable Render Feature to the list of Renderer Features of the Forward Renderer.", MessageType.Error);
                if (GUILayout.Button("Watch Setup Video Tutorial"))
                {
                    Application.OpenURL("https://youtu.be/OlCnEAcHJm0");
                }
                return;
            }

            if (!HighlightPlusRenderPassFeature.installed)
            {
                EditorGUILayout.HelpBox("Highlight Plus Render Feature must be added to the list of features of the Forward Renderer in the Universal Rendering Pipeline asset.", MessageType.Warning);
                if (GUILayout.Button("Watch Setup Video Tutorial"))
                {
                    Application.OpenURL("https://youtu.be/OlCnEAcHJm0");
                }
                if (GUILayout.Button("Go to Universal Rendering Pipeline Asset"))
                {
                    Selection.activeObject = pipe;
                }
                EditorGUILayout.Separator();
            }

            bool isManager = thisEffect.GetComponent <HighlightManager>() != null;

            serializedObject.Update();

            EditorGUILayout.BeginHorizontal();
            HighlightProfile prevProfile = (HighlightProfile)profile.objectReferenceValue;

            EditorGUILayout.PropertyField(profile, new GUIContent("Profile", "Create or load stored presets."));
            if (profile.objectReferenceValue != null)
            {
                if (prevProfile != profile.objectReferenceValue)
                {
                    profileChanged = true;
                }

                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                GUILayout.Label("", GUILayout.Width(EditorGUIUtility.labelWidth));
                if (GUILayout.Button(new GUIContent("Create", "Creates a new profile which is a copy of the current settings."), GUILayout.Width(60)))
                {
                    CreateProfile();
                    profileChanged     = false;
                    enableProfileApply = false;
                    GUIUtility.ExitGUI();
                    return;
                }
                if (GUILayout.Button(new GUIContent("Load", "Updates settings with the profile configuration."), GUILayout.Width(60)))
                {
                    profileChanged = true;
                }
                GUI.enabled = enableProfileApply;
                if (GUILayout.Button(new GUIContent("Save", "Updates profile configuration with changes in this inspector."), GUILayout.Width(60)))
                {
                    enableProfileApply = false;
                    profileChanged     = false;
                    thisEffect.profile.Save(thisEffect);
                    EditorUtility.SetDirty(thisEffect.profile);
                    GUIUtility.ExitGUI();
                    return;
                }
                GUI.enabled = true;
                if (GUILayout.Button(new GUIContent("Locate", "Finds the profile in the project"), GUILayout.Width(60)))
                {
                    if (thisEffect.profile != null)
                    {
                        Selection.activeObject = thisEffect.profile;
                        EditorGUIUtility.PingObject(thisEffect.profile);
                    }
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.PropertyField(profileSync, new GUIContent("Sync With Profile", "If disabled, profile settings will only be loaded when clicking 'Load' which allows you to customize settings after loading a profile and keep those changes."));
                EditorGUILayout.BeginHorizontal();
            }
            else
            {
                if (GUILayout.Button(new GUIContent("Create", "Creates a new profile which is a copy of the current settings."), GUILayout.Width(60)))
                {
                    CreateProfile();
                    GUIUtility.ExitGUI();
                    return;
                }
            }
            EditorGUILayout.EndHorizontal();


            if (isManager)
            {
                EditorGUILayout.HelpBox("These are default settings for highlighted objects. If the highlighted object already has a Highlight Effect component, those properties will be used.", MessageType.Info);
            }
            else
            {
                EditorGUILayout.PropertyField(previewInEditor);
            }

            EditorGUILayout.PropertyField(ignoreObjectVisibility);
            if (thisEffect.staticChildren)
            {
                EditorGUILayout.HelpBox("This GameObject or one of its children is marked as static. If highlight is not visible, add a MeshCollider to them.", MessageType.Warning);
            }

            EditorGUILayout.PropertyField(reflectionProbes);
            EditorGUILayout.PropertyField(normalsOption);
            EditorGUILayout.PropertyField(GPUInstancing);

            EditorGUILayout.Separator();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Highlight Options", EditorStyles.boldLabel);
            if (GUILayout.Button("Help", GUILayout.Width(50)))
            {
                EditorUtility.DisplayDialog("Quick Help", "Move the mouse over a setting for a short description.\n\nVisit kronnect.com's forum for support, questions and more cool assets.\n\nIf you like Highlight Plus please rate it or leave a review on the Asset Store! Thanks.", "Ok");
            }
            EditorGUILayout.EndHorizontal();
            EditorGUI.BeginChangeCheck();
            if (!isManager)
            {
                EditorGUILayout.PropertyField(ignore, new GUIContent("Ignore", "This object won't be highlighted."));
                if (!ignore.boolValue)
                {
                    EditorGUILayout.PropertyField(highlighted);
                }
            }
            if (!ignore.boolValue)
            {
                EditorGUILayout.PropertyField(effectGroup, new GUIContent("Include", "Additional objects to highlight. Pro tip: when highlighting multiple objects at the same time include them in the same layer or under the same parent."));
                if (effectGroup.intValue == (int)TargetOptions.LayerInScene || effectGroup.intValue == (int)TargetOptions.LayerInChildren)
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(effectGroupLayer, new GUIContent("Layer"));
                    EditorGUI.indentLevel--;
                }
                if (effectGroup.intValue != (int)TargetOptions.OnlyThisObject && effectGroup.intValue != (int)TargetOptions.Scripting)
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(effectNameFilter, new GUIContent("Object Name Filter"));
                    EditorGUILayout.PropertyField(combineMeshes);
                    EditorGUI.indentLevel--;
                }
                EditorGUILayout.PropertyField(alphaCutOff, new GUIContent("Alpha Cut Off", "Only for semi-transparent objects. Leave this to zero for normal opaque objects."));
                EditorGUILayout.PropertyField(cullBackFaces);
                EditorGUILayout.PropertyField(fadeInDuration);
                EditorGUILayout.PropertyField(fadeOutDuration);
                if ((PlayerSettings.virtualRealitySupported && ((outlineQuality.intValue == (int)QualityLevel.Highest && outline.floatValue > 0) || (glowQuality.intValue == (int)QualityLevel.Highest && glow.floatValue > 0))))
                {
                    EditorGUILayout.PropertyField(flipY, new GUIContent("Flip Y Fix", "Flips outline/glow effect to fix bug introduced in Unity 2019.1.0 when VR is enabled."));
                }
                if (glowQuality.intValue != (int)QualityLevel.Highest || outlineQuality.intValue != (int)QualityLevel.Highest)
                {
                    EditorGUILayout.PropertyField(constantWidth, new GUIContent("Constant Width", "Compensates outline/glow width with depth increase."));
                }
                EditorGUILayout.PropertyField(subMeshMask);
                EditorGUILayout.Separator();
                EditorGUILayout.LabelField("Effects", EditorStyles.boldLabel);

                EditorGUILayout.BeginVertical(GUI.skin.box);
                DrawSectionField(outline, "Outline", outline.floatValue > 0);
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(outlineWidth, new GUIContent("Width"));
                EditorGUILayout.PropertyField(outlineColor, new GUIContent("Color"));
                EditorGUILayout.BeginHorizontal();
                QualityPropertyField(outlineQuality);
                if (outlineQuality.intValue == (int)QualityLevel.Highest)
                {
                    GUILayout.Label("(Screen-Space Effect)");
                }
                else
                {
                    GUILayout.Label("(Mesh-based Effect)");
                }
                EditorGUILayout.EndHorizontal();
                CheckVRSupport(outlineQuality.intValue);
                CheckDepthTextureSupport(outlineQuality.intValue);
                if (outlineQuality.intValue == (int)QualityLevel.Highest)
                {
                    EditorGUILayout.PropertyField(outlineDownsampling, new GUIContent("Downsampling"));
                }
                if (outlineQuality.intValue == (int)QualityLevel.Highest)
                {
                    EditorGUILayout.PropertyField(outlineBlitDebug, new GUIContent("Debug View", "Shows the blitting rectangle on the screen."));
                    if (!Application.isPlaying && outlineBlitDebug.boolValue && (!previewInEditor.boolValue || !highlighted.boolValue))
                    {
                        EditorGUILayout.HelpBox("Enable \"Preview In Editor\" and \"Highlighted\" to display the outline Debug View.", MessageType.Warning);
                    }
                }

                //GUI.enabled = outlineQuality.intValue != (int)QualityLevel.Highest || CheckForwardMSAA();
                if (outlineQuality.intValue == (int)QualityLevel.Highest && (glow.floatValue > 0 && glowQuality.intValue == (int)QualityLevel.Highest))
                {
                    outlineVisibility.intValue = glowVisibility.intValue;
                }
                EditorGUILayout.PropertyField(outlineVisibility, new GUIContent("Visibility"));
                EditorGUILayout.PropertyField(outlineIndependent, new GUIContent("Independent", "Do not combine outline with other highlighted objects."));
                GUI.enabled = true;

                EditorGUI.indentLevel--;
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical(GUI.skin.box);
                DrawSectionField(glow, "Outer Glow", glow.floatValue > 0);
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(glowWidth, new GUIContent("Width"));
                EditorGUILayout.BeginHorizontal();
                QualityPropertyField(glowQuality);
                if (glowQuality.intValue == (int)QualityLevel.Highest)
                {
                    GUILayout.Label("(Screen-Space Effect)");
                }
                else
                {
                    GUILayout.Label("(Mesh-based Effect)");
                }
                EditorGUILayout.EndHorizontal();
                CheckVRSupport(glowQuality.intValue);
                CheckDepthTextureSupport(glowQuality.intValue);
                if (glowQuality.intValue == (int)QualityLevel.Highest)
                {
                    EditorGUILayout.PropertyField(glowDownsampling, new GUIContent("Downsampling"));
                    EditorGUILayout.PropertyField(glowHQColor, new GUIContent("Color"));
                }
                EditorGUILayout.PropertyField(glowAnimationSpeed, new GUIContent("Animation Speed"));
                if (glowQuality.intValue == (int)QualityLevel.Highest)
                {
                    EditorGUILayout.PropertyField(glowBlitDebug, new GUIContent("Debug View", "Shows the blitting rectangle on the screen."));
                    if (!Application.isPlaying && glowBlitDebug.boolValue && (!previewInEditor.boolValue || !highlighted.boolValue))
                    {
                        EditorGUILayout.HelpBox("Enable \"Preview In Editor\" and \"Highlighted\" to display the glow Debug View.", MessageType.Warning);
                    }
                    EditorGUILayout.PropertyField(glowVisibility, new GUIContent("Visibility"));
                }
                else
                {
                    EditorGUILayout.PropertyField(glowVisibility, new GUIContent("Visibility"));
                    EditorGUILayout.PropertyField(glowDithering, new GUIContent("Dithering"));
                    if (glowDithering.boolValue)
                    {
                        EditorGUI.indentLevel++;
                        EditorGUILayout.PropertyField(glowMagicNumber1, new GUIContent("Magic Number 1"));
                        EditorGUILayout.PropertyField(glowMagicNumber2, new GUIContent("Magic Number 2"));
                        EditorGUI.indentLevel--;
                    }
                    EditorGUILayout.PropertyField(glowBlendPasses, new GUIContent("Blend Passes"));
                    if (!glowBlendPasses.boolValue)
                    {
                        HighlightEffect ef = (HighlightEffect)target;
                        if (ef.glowPasses != null)
                        {
                            for (int k = 0; k < ef.glowPasses.Length - 1; k++)
                            {
                                if (ef.glowPasses[k].offset > ef.glowPasses[k + 1].offset)
                                {
                                    EditorGUILayout.HelpBox("Glow pass " + k + " has a greater offset than the next one. Reduce it to ensure the next glow pass is visible.", MessageType.Warning);
                                }
                            }
                        }
                    }
                    EditorGUILayout.PropertyField(glowPasses, true);
                }
                EditorGUI.indentLevel--;
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical(GUI.skin.box);
                DrawSectionField(innerGlow, "Inner Glow", innerGlow.floatValue > 0);
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(innerGlowColor, new GUIContent("Color"));
                EditorGUILayout.PropertyField(innerGlowWidth, new GUIContent("Width"));
                EditorGUILayout.PropertyField(innerGlowVisibility, new GUIContent("Visibility"));
                EditorGUI.indentLevel--;
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical(GUI.skin.box);
                DrawSectionField(overlay, "Overlay", overlay.floatValue > 0);
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(overlayColor, new GUIContent("Color"));
                EditorGUILayout.PropertyField(overlayBlending, new GUIContent("Blending"));
                EditorGUILayout.PropertyField(overlayMinIntensity, new GUIContent("Min Intensity"));
                EditorGUILayout.PropertyField(overlayAnimationSpeed, new GUIContent("Animation Speed"));
                EditorGUI.indentLevel--;
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginVertical(GUI.skin.box);
                DrawSectionField(targetFX, "Target", targetFX.boolValue);
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(targetFXTexture, new GUIContent("Texture", "The texture that contains the shape to be drawn over the highlighted object."));
                EditorGUILayout.PropertyField(targetFXColor, new GUIContent("Color"));
                EditorGUILayout.PropertyField(targetFXCenter, new GUIContent("Center", "Optionally assign a transform. Target will follow transform. If the object is skinned, you can also assign a bone to reflect currenct animation position."));
                EditorGUILayout.PropertyField(targetFXRotationSpeed, new GUIContent("Rotation Speed"));
                EditorGUILayout.PropertyField(targetFXInitialScale, new GUIContent("Initial Scale"));
                EditorGUILayout.PropertyField(targetFXEndScale, new GUIContent("End Scale"));
                EditorGUILayout.PropertyField(targetFXTransitionDuration, new GUIContent("Transition Duration"));
                EditorGUILayout.PropertyField(targetFXStayDuration, new GUIContent("Stay Duration"));
                EditorGUI.indentLevel--;
                EditorGUILayout.EndVertical();
            }

            EditorGUILayout.BeginVertical(GUI.skin.box);
            EditorGUILayout.PropertyField(seeThrough);
            if (isManager && seeThrough.intValue == (int)SeeThroughMode.AlwaysWhenOccluded)
            {
                EditorGUILayout.HelpBox("This option is not valid in Manager.\nTo make an object always visible add a Highlight Effect component to the gameobject and enable this option on the component.", MessageType.Error);
            }
            EditorGUI.indentLevel++;
            EditorGUILayout.PropertyField(seeThroughIntensity, new GUIContent("Intensity"));
            EditorGUILayout.PropertyField(seeThroughTintColor, new GUIContent("Color"));
            EditorGUILayout.PropertyField(seeThroughTintAlpha, new GUIContent("Color Blend"));
            EditorGUILayout.PropertyField(seeThroughNoise, new GUIContent("Noise"));
            EditorGUILayout.PropertyField(seeThroughBorder, new GUIContent("Border When Hidden" + ((seeThroughBorder.floatValue > 0) ? " •" : "")));
            EditorGUI.indentLevel++;
            EditorGUILayout.PropertyField(seeThroughBorderWidth, new GUIContent("Width"));
            EditorGUILayout.PropertyField(seeThroughBorderColor, new GUIContent("Color"));
            EditorGUI.indentLevel--;
            EditorGUILayout.EndVertical();
            EditorGUILayout.BeginVertical(GUI.skin.box);
            EditorGUILayout.LabelField("Hit FX Sample");
            if (!Application.isPlaying)
            {
                EditorGUILayout.HelpBox("Enter Play Mode to test this feature. In your code, call effect.HitFX() method to execute this hit effect.", MessageType.Info);
            }
            else
            {
                EditorGUI.indentLevel++;
                hitColor        = EditorGUILayout.ColorField(new GUIContent("Color"), hitColor);
                hitDuration     = EditorGUILayout.FloatField(new GUIContent("Duration"), hitDuration);
                hitMinIntensity = EditorGUILayout.Slider(new GUIContent("Min Intensity"), hitMinIntensity, 0, 1);
                if (GUILayout.Button("Execute Hit"))
                {
                    thisEffect.HitFX(hitColor, hitDuration, hitMinIntensity);
                }
                EditorGUI.indentLevel--;
            }
            EditorGUILayout.EndVertical();

            if (serializedObject.ApplyModifiedProperties() || profileChanged)
            {
                if (thisEffect.profile != null)
                {
                    if (profileChanged)
                    {
                        thisEffect.profile.Load(thisEffect);
                        profileChanged     = false;
                        enableProfileApply = false;
                    }
                    else
                    {
                        enableProfileApply = true;
                    }
                }

                foreach (HighlightEffect effect in targets)
                {
                    effect.Refresh();
                }
            }
        }
Beispiel #19
0
 void OnEnable()
 {
     profile                = serializedObject.FindProperty("profile");
     profileSync            = serializedObject.FindProperty("profileSync");
     ignoreObjectVisibility = serializedObject.FindProperty("ignoreObjectVisibility");
     reflectionProbes       = serializedObject.FindProperty("reflectionProbes");
     ignore                = serializedObject.FindProperty("ignore");
     previewInEditor       = serializedObject.FindProperty("previewInEditor");
     effectGroup           = serializedObject.FindProperty("effectGroup");
     effectGroupLayer      = serializedObject.FindProperty("effectGroupLayer");
     alphaCutOff           = serializedObject.FindProperty("alphaCutOff");
     cullBackFaces         = serializedObject.FindProperty("cullBackFaces");
     highlighted           = serializedObject.FindProperty("_highlighted");
     fadeInDuration        = serializedObject.FindProperty("fadeInDuration");
     fadeOutDuration       = serializedObject.FindProperty("fadeOutDuration");
     flipY                 = serializedObject.FindProperty("flipY");
     constantWidth         = serializedObject.FindProperty("constantWidth");
     overlay               = serializedObject.FindProperty("overlay");
     overlayColor          = serializedObject.FindProperty("overlayColor");
     overlayAnimationSpeed = serializedObject.FindProperty("overlayAnimationSpeed");
     overlayMinIntensity   = serializedObject.FindProperty("overlayMinIntensity");
     overlayBlending       = serializedObject.FindProperty("overlayBlending");
     outline               = serializedObject.FindProperty("outline");
     outlineColor          = serializedObject.FindProperty("outlineColor");
     outlineWidth          = serializedObject.FindProperty("outlineWidth");
     outlineQuality        = serializedObject.FindProperty("outlineQuality");
     outlineAlwaysOnTop    = serializedObject.FindProperty("outlineAlwaysOnTop");
     outlineOptimalBlit    = serializedObject.FindProperty("outlineOptimalBlit");
     outlineBlitDebug      = serializedObject.FindProperty("outlineBlitDebug");
     outlineDownsampling   = serializedObject.FindProperty("outlineDownsampling");
     glow                       = serializedObject.FindProperty("glow");
     glowWidth                  = serializedObject.FindProperty("glowWidth");
     glowQuality                = serializedObject.FindProperty("glowQuality");
     glowHQColor                = serializedObject.FindProperty("glowHQColor");
     glowAnimationSpeed         = serializedObject.FindProperty("glowAnimationSpeed");
     glowDithering              = serializedObject.FindProperty("glowDithering");
     glowMagicNumber1           = serializedObject.FindProperty("glowMagicNumber1");
     glowMagicNumber2           = serializedObject.FindProperty("glowMagicNumber2");
     glowAnimationSpeed         = serializedObject.FindProperty("glowAnimationSpeed");
     glowPasses                 = serializedObject.FindProperty("glowPasses");
     glowAlwaysOnTop            = serializedObject.FindProperty("glowAlwaysOnTop");
     glowOptimalBlit            = serializedObject.FindProperty("glowOptimalBlit");
     glowBlitDebug              = serializedObject.FindProperty("glowBlitDebug");
     glowDownsampling           = serializedObject.FindProperty("glowDownsampling");
     innerGlow                  = serializedObject.FindProperty("innerGlow");
     innerGlowColor             = serializedObject.FindProperty("innerGlowColor");
     innerGlowWidth             = serializedObject.FindProperty("innerGlowWidth");
     innerGlowAlwaysOnTop       = serializedObject.FindProperty("innerGlowAlwaysOnTop");
     seeThrough                 = serializedObject.FindProperty("seeThrough");
     seeThroughIntensity        = serializedObject.FindProperty("seeThroughIntensity");
     seeThroughTintAlpha        = serializedObject.FindProperty("seeThroughTintAlpha");
     seeThroughTintColor        = serializedObject.FindProperty("seeThroughTintColor");
     targetFX                   = serializedObject.FindProperty("targetFX");
     targetFXTexture            = serializedObject.FindProperty("targetFXTexture");
     targetFXRotationSpeed      = serializedObject.FindProperty("targetFXRotationSpeed");
     targetFXInitialScale       = serializedObject.FindProperty("targetFXInitialScale");
     targetFXEndScale           = serializedObject.FindProperty("targetFXEndScale");
     targetFXColor              = serializedObject.FindProperty("targetFXColor");
     targetFXCenter             = serializedObject.FindProperty("targetFXCenter");
     targetFXTransitionDuration = serializedObject.FindProperty("targetFXTransitionDuration");
     targetFXStayDuration       = serializedObject.FindProperty("targetFXStayDuration");
     thisEffect                 = (HighlightEffect)target;
     thisEffect.Refresh();
 }
Beispiel #20
0
		public override void OnInspectorGUI () {
			bool isManager = thisEffect.GetComponent<HighlightManager> () != null;
			EditorGUILayout.Separator ();
			serializedObject.Update ();


			EditorGUILayout.BeginHorizontal ();
			HighlightProfile prevProfile = (HighlightProfile)profile.objectReferenceValue;
			EditorGUILayout.PropertyField (profile, new GUIContent ("Profile", "Create or load stored presets."));
			if (profile.objectReferenceValue != null) {

				if (prevProfile != profile.objectReferenceValue) {
					profileChanged = true;
				}

				EditorGUILayout.EndHorizontal ();
				EditorGUILayout.BeginHorizontal ();
				GUILayout.Label ("", GUILayout.Width (EditorGUIUtility.labelWidth));
				if (GUILayout.Button (new GUIContent ("Create", "Creates a new profile which is a copy of the current settings."), GUILayout.Width (60))) {
					CreateProfile ();
					profileChanged = false;
					enableProfileApply = false;
					GUIUtility.ExitGUI ();
					return;
				}
				if (GUILayout.Button (new GUIContent ("Load", "Updates fog settings with the profile configuration."), GUILayout.Width (60))) {
					profileChanged = true;
				}
				if (!enableProfileApply)
					GUI.enabled = false;
				if (GUILayout.Button (new GUIContent ("Save", "Updates profile configuration with changes in this inspector."), GUILayout.Width (60))) {
					enableProfileApply = false;
					profileChanged = false;
					thisEffect.profile.Save (thisEffect);
					EditorUtility.SetDirty (thisEffect.profile);
					GUIUtility.ExitGUI ();
					return;
				}
				GUI.enabled = true;
				EditorGUILayout.EndHorizontal ();
				EditorGUILayout.PropertyField (profileSync, new GUIContent ("Sync With Profile", "If disabled, profile settings will only be loaded when clicking 'Load' which allows you to customize settings after loading a profile and keep those changes."));
				EditorGUILayout.BeginHorizontal ();
			} else {
				if (GUILayout.Button (new GUIContent ("Create", "Creates a new profile which is a copy of the current settings."), GUILayout.Width (60))) {
					CreateProfile ();
					GUIUtility.ExitGUI ();
					return;
				}
			}
			EditorGUILayout.EndHorizontal ();


			if (isManager) {
				EditorGUILayout.HelpBox ("These are default settings for highlighted objects. If the highlighted object already has a Highlight Effect component, those properties will be used.", MessageType.Info);
			} else {
				EditorGUILayout.PropertyField (previewInEditor);
			}

			EditorGUILayout.PropertyField (ignoreObjectVisibility);
			if (thisEffect.staticChildren) {
				EditorGUILayout.HelpBox ("This GameObject or one of its children is marked as static. If highlight is not visible, add a MeshCollider to them.", MessageType.Warning);
			}

			EditorGUILayout.Separator ();
			EditorGUILayout.LabelField ("Highlight Options", EditorStyles.boldLabel);
			EditorGUI.BeginChangeCheck ();
			if (!isManager) {
				EditorGUILayout.PropertyField (ignore, new GUIContent ("Ignore", "This object won't be highlighted."));
				if (!ignore.boolValue) {
					EditorGUI.BeginChangeCheck ();
					EditorGUILayout.PropertyField (highlighted);
					if (EditorGUI.EndChangeCheck ()) {
						foreach (HighlightEffect effect in targets) {
							effect.SetHighlighted (highlighted.boolValue);
						}
					}
				}
			}
			if (!ignore.boolValue) {
				EditorGUILayout.PropertyField (fadeInDuration);
				EditorGUILayout.PropertyField (fadeOutDuration);
				DrawSectionField (overlay, "Overlay", overlay.floatValue > 0);
				if (overlay.floatValue < overlayMinIntensity.floatValue) {
					overlayMinIntensity.floatValue = overlay.floatValue;
				}
				EditorGUI.indentLevel++;
				EditorGUILayout.PropertyField (overlayColor, new GUIContent ("Color"));
				EditorGUILayout.PropertyField (overlayBlending, new GUIContent ("Blending"));
				EditorGUILayout.PropertyField (overlayMinIntensity, new GUIContent ("Min Intensity"));
				if (overlayMinIntensity.floatValue > overlay.floatValue) {
					overlay.floatValue = overlayMinIntensity.floatValue;
				}
				EditorGUILayout.PropertyField (overlayAnimationSpeed, new GUIContent ("Animation Speed"));
				EditorGUI.indentLevel--;
				DrawSectionField (outline, "Outline", outline.floatValue > 0);
				EditorGUI.indentLevel++;
				EditorGUILayout.PropertyField (outlineWidth, new GUIContent ("Width"));
				EditorGUILayout.PropertyField (outlineColor, new GUIContent ("Color"));
				EditorGUILayout.PropertyField (outlineHQ, new GUIContent ("HQ", "Additional passes to create a better outline on certain shapes."));
				EditorGUILayout.PropertyField (outlineAlwaysOnTop, new GUIContent ("Always On Top", "Shows outline on top of any occluding objects."));
				EditorGUILayout.PropertyField (outlineCullBackFaces, new GUIContent ("Cull Back Faces", "Do not render back facing triangles."));
				EditorGUI.indentLevel--;
				DrawSectionField (innerGlow, "Inner Glow", innerGlow.floatValue > 0);
				EditorGUI.indentLevel++;
				EditorGUILayout.PropertyField (innerGlowColor, new GUIContent ("Color"));
				EditorGUILayout.PropertyField (innerGlowWidth, new GUIContent ("Width"));
				EditorGUILayout.PropertyField (innerGlowAlwaysOnTop, new GUIContent ("Always On Top", "Shows inner glow on top of any occluding objects."));
				EditorGUI.indentLevel--;
				DrawSectionField (glow, "Outer Glow", glow.floatValue > 0);
				EditorGUI.indentLevel++;
				EditorGUILayout.PropertyField (glowWidth, new GUIContent ("Width"));
				EditorGUILayout.PropertyField (glowHQ, new GUIContent ("HQ", "Additional passes to create a better glow on certain shapes."));
				EditorGUILayout.PropertyField (glowAnimationSpeed, new GUIContent ("Animation Speed"));
				EditorGUILayout.PropertyField (glowDithering, new GUIContent ("Dithering"));
				if (glowDithering.boolValue) {
					EditorGUI.indentLevel++;
					EditorGUILayout.PropertyField (glowMagicNumber1, new GUIContent ("Magic Number 1"));
					EditorGUILayout.PropertyField (glowMagicNumber2, new GUIContent ("Magic Number 2"));
					EditorGUI.indentLevel--;
				}
				EditorGUILayout.PropertyField (glowAlwaysOnTop, new GUIContent ("Always On Top", "Shows outer glow on top of any occluding objects."));
				EditorGUILayout.PropertyField (glowCullBackFaces, new GUIContent ("Cull Back Faces", "Do not render back facing triangles."));
				EditorGUILayout.PropertyField (glowPasses, true);
				EditorGUI.indentLevel--;
				DrawSectionField (targetFX, "Target", targetFX.boolValue);
				EditorGUI.indentLevel++;
				EditorGUILayout.PropertyField (targetFXTexture, new GUIContent ("Texture"));
				EditorGUILayout.PropertyField (targetFXColor, new GUIContent ("Color"));
				EditorGUILayout.PropertyField (targetFXCenter, new GUIContent ("Center", "Optionally assign a transform. Target will follow transform. If the object is skinned, you can also assign a bone to reflect currenct animation position."));
				EditorGUILayout.PropertyField (targetFXRotationSpeed, new GUIContent ("Rotation Speed"));
				EditorGUILayout.PropertyField (targetFXInitialScale, new GUIContent ("Initial Scale"));
				EditorGUILayout.PropertyField (targetFXEndScale, new GUIContent ("End Scale"));
				EditorGUILayout.PropertyField (targetFXTransitionDuration, new GUIContent ("Transition Duration"));
				EditorGUILayout.PropertyField (targetFXStayDuration, new GUIContent ("Stay Duration"));
				EditorGUI.indentLevel--;
			}
			EditorGUILayout.Separator ();
			EditorGUILayout.LabelField ("See-Through Options", EditorStyles.boldLabel);
			EditorGUILayout.PropertyField (seeThrough);
			if (isManager && seeThrough.intValue == (int)SeeThroughMode.AlwaysWhenOccluded) {
				EditorGUILayout.HelpBox ("This option is not valid in Manager.\nTo make an object always visible add a Highlight Effect component to the gameobject and enable this option on the component.", MessageType.Error);
			}
			EditorGUI.indentLevel++;
			EditorGUILayout.PropertyField (seeThroughIntensity, new GUIContent ("Intensity"));
			EditorGUILayout.PropertyField (seeThroughTintAlpha, new GUIContent ("Alpha"));
			EditorGUILayout.PropertyField (seeThroughTintColor, new GUIContent ("Color"));
			EditorGUI.indentLevel--;

			if (serializedObject.ApplyModifiedProperties () || profileChanged) {
				if (thisEffect.profile != null) {
					if (profileChanged) {
						thisEffect.profile.Load (thisEffect);
						profileChanged = false;
						enableProfileApply = false;
					} else {
						enableProfileApply = true;
					}
				}

				foreach (HighlightEffect effect in targets) {
					effect.Refresh ();
				}
			}
			HighlightEffect _effect = (HighlightEffect)target;
			if (_effect != null && _effect.previewInEditor) {
				EditorUtility.SetDirty (_effect);
			}
		}