- Home /
DynamicGI.SetEmissive not working
Wanted to upgrade my Star Map project to Unity 5 and see if there's a difference in performance using just the Standard Shader's emission property. But when my objects (stars) are created and their colors/emission colors are set something's off.
See, the colors all get set correctly but the emission property seems bugged out. If after the object is created/instantiated I go in the scene view and change any property on the material of an object manually suddenly it begins using the correct emission intensity.
I've been snooping around and haven't seen any solutions. Read somewhere to make the objects static which I did but to no effect. Tried utilizing the DynamicGI.SetEmissive on the associated renderers but still nothing (actually it doesn't seem to have any effect whatsoever). DynamicGI.UpdateMaterials has no effect as well. Only thing that works seems to be setting the material properties via material.SetColor. Any ideas?
Here's my sample code:
Renderer rend = child.gameObject.GetComponent<Renderer>();
rend.material.SetColor("_Color", starColor);
rend.material.SetColor("_EmissionColorUI", starColor);
rend.material.SetColor("_EmissionColor", starColor);
This will work "sort of" but the emission's still off. If I do
Renderer rend = child.gameObject.GetComponent<Renderer>();
DynamicGI.SetEmissive(rend, starColor);
DynamicGI.UpdateMaterials(rend);
While the emission works correctly- it's mostly as if there aren't any changes. My theory is that DynamicGI isn't effecting the object at all and it's just instantiating with it's unaltered properties/colors (white).
Your answer
Follow this Question
Related Questions
Invisible Emissive GameObject? 0 Answers
big scale for better graphics? 0 Answers
How to call Graphics.DrawTexture() in Update 1 Answer
Creating a Masking Object with Variable Pass Through 0 Answers
Texture help 0 Answers