- Home /
Enable Emission to update at run time in editor 5.6.1?
I recently updated Unity from 5.5.2 to 5.6.1 since I started a new project and figured it would be a good time to do so.
In one of my scripts I had a blinking glow functions that adjusted the emission value to create the effect.
In 5.5.2 it worked in the editor without any special needs or anything of that sort.
In 5.6.1, it no longer works in the editor by default and to get it to work in the editor I have to open up the material on the object in the inspector or put on a different shader on it which causes it to lose the texture reference until I open the material up in the inspector.
I read that I have to use enable keywords to get the materials to work right in the editor at run time but I haven't been able to find a reference to what keywords are available.
Answer by ScienceIsAwesome · Sep 27, 2017 at 02:12 PM
Wow, this problem did not have an easily discovered answer...
GetComponent<Renderer>().UpdateGIMaterials();
You must call it every time you change the emissive material in any way, this single function gets its very own extension class so you don't even find it when you look under Renderer...
https://docs.unity3d.com/ScriptReference/RendererExtensions.html
Answer by Noel9386 · May 31, 2017 at 03:24 PM
Found a list of all Keywords at https://docs.unity3d.com/Manual/MaterialsAccessingViaScript.html