Good Morning everyone,
My team and I have been having issues with the post processing stack asset in regards to the bloom effect. In one of our levels we have a switch and when the switch is toggled it is supposed to toggle the lights on and off it does this perfectly. BUT for some strange reason the bloom on the lights gets super bright. Now when I have the post processing script turned off this issue doesn't happen so I know it is linked with it. Here is a picture of what I am talking about
Before Toggle
![alt text][1]
After Toggle
![alt text][2]
And here is the code that controls the lights when they are toggled
using UnityEngine;
using System.Collections;
public class L7TubeLights : MonoBehaviour {
public bool TestButton = true;
public bool invertPowerFunction = false;
private bool fireOnceCheck = false;
public Renderer[] lightList;
public GameObject electricObject;
private Color whiteGreen;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
TurnLightsDown();
TurnLightsUp();
}
void TurnLightsDown () {
//Old code for testing: TestButton == false && fireOnceCheck == false
if (electricObject.GetComponent().hasEnergy == false && fireOnceCheck == false)
{
if (invertPowerFunction == false)
{
foreach (Renderer lightRenderers in lightList)
{
lightRenderers.material.color = Color.black;
lightRenderers.material.SetColor ("_EmissionColor", Color.black);
DynamicGI.SetEmissive (lightRenderers, Color.black);
RendererExtensions.UpdateGIMaterials (lightRenderers);
Debug.Log("Turning lights down.");
fireOnceCheck = true;
}
}
/*else
{
foreach (Renderer lightRenderers in lightList)
{
lightRenderers.material.color = Color.white;
lightRenderers.material.SetColor ("_EmissionColor", Color.white * 5);
DynamicGI.SetEmissive (lightRenderers, Color.white * 5);
DynamicGI.UpdateMaterials (lightRenderers);
//Debug.Log("Turning lights up.");
fireOnceCheck = true;
}
}*/
}
}
void TurnLightsUp () {
//Old code for testing: TestButton == true && fireOnceCheck == true
if (electricObject.GetComponent().hasEnergy == true && fireOnceCheck == true)
{
if (invertPowerFunction == false)
{
foreach (Renderer lightRenderers in lightList)
{
lightRenderers.material.color = Color.white;
lightRenderers.material.SetColor ("_EmissionColor", Color.white * 5);
DynamicGI.SetEmissive (lightRenderers, Color.white * 5);
RendererExtensions.UpdateGIMaterials (lightRenderers);
Debug.Log("Turning lights up.");
fireOnceCheck = false;
Debug.Log("Hopefully this doesn't come up multiple times because if it does then the issue is here!!");
}
}
/*else
{
foreach (Renderer lightRenderers in lightList)
{
lightRenderers.material.color = Color.black;
lightRenderers.material.SetColor ("_EmissionColor", Color.black);
DynamicGI.SetEmissive (lightRenderers, Color.black);
DynamicGI.UpdateMaterials (lightRenderers);
//Debug.Log("Turning lights down.");
fireOnceCheck = false;
}
}*/
}
}
}
So my question is how do I fix this issue? This is a huge issue for our playtesters because the light can get super bright and it hurts the players eye's.
[1]: /storage/temp/121167-beforetoggle.png
[2]: /storage/temp/121168-aftertoggle.png
↧