Ever since I installed Unity 5.4, I have been working peacefully in the editor. However, today when I created a build, I realized that something about the graphics were a bit off. After a bit of tinkering around, I realized that the cause (or at least part of it) was from the Tonemapping script (set on Photographic mode). The image attached below will explain what I am experiencing. Just a heads up: this problem did not occur in Unity 5.3.x builds, so it is a result of upgrading to Unity 5.4 and pretty sure it’s not my graphics card. I am also aware that there are graphical tweaks/improvements.
EDIT: It seems that instantiating the camera in a build seems to break the image effect somehow. But, I need to instantiate the camera because the player needs to spawn.
Here are my camera setup:
Tonemapping set on photographic
Camera HDR enabled
Deferred enabled
The only other image effects enabled are: Bloom, Global Fog, and Sun Shafts.
Not any nice ones. The issue is that when the prefab is being instantiated the image effect is being added to the list of effects, then on enable happens and the same effect is added a second time This was caused by another bug fix. #sideeffects
I’ve tracked the issue and am putting a fix in now (also wrote a test so it won’t regress ).
Work around would be: Keep effects disabled on camera, then after instantiation turn them on. This fix will go in a patch release asap.
Also, I seem to be getting this error with Sun Shafts and another custom image effect. I used a workaround that someone posted, but it’s strange because it should have been fixed already? Is this somehow related to the image effect duplication?
If it helps, here is the code for the workaround, so you can get a better idea of what fixes it:
This coroutine is called once on Awake().
private IEnumerator Unity54Fix_SunShafts() {
if(sunShafts != null) {
sunShafts.enabled = false;
yield return new WaitForEndOfFrame();
sunShafts.enabled = true; //Removing this will spam "self -> GetEnabled()"
yield return null;
sunShafts.enabled = settingsInst.videoSettings.sunShafts; //Enabling/disabling the sun shafts based on the in-game settings.
//Error spam is fixed.
}
}
This issue isn’t too much of a problem since I already found a (thankfully short) workaround, but it would be nice if it wasn’t necessary. #sketchyworkarounds