- Home /
Is it possiable to change the Emissive Color on VertexLit Blended Material with a script?
I'm using java and have been at this for hours and it should be as simple as the below code but it doesn't work. I can get the other materials to work, but not the VertexLit Blended Material.
Is this even possible? I'm begging to think it's not, which would be a let down as it looks so good for the script I'm writing..
Is there another way to do this? I have looked through all the documentation. I have tried both function start and update. I also have @script ExecuteInEditMode() so that everything it in real time.
renderer.Material.SetColor ("_Emission", globalFogColor);
Answer by Radazen · Mar 13, 2012 at 05:47 AM
Despite what the docs say about "_Emission"
being the name of the emissive property of a shader, the name is actually defined in the shader itself and can be something else. If you download the source for the built-in shaders and look at the Particle VertexLit Blended shader, you can see that the property is actually called "_EmisColor"
there, and using that with renderer.Material.SetColor should work.
Saved my life with your answer! Thanks! I'd +1 it, but the website won't let me :P
You don't even have to download the shader source. Just click "edit" button in the inspector next to the shader name and it will give you a list of all properties with their name.
"You don't even have to download the shader source. Just click "edit"
...ya know, sometimes things are just obvious. Can't believe this has been here all this time.
Thanks for the post! Saves me a bit of headache
"_EmisColor" is worked for me properly.
"_EmissionColor" is not working in Unity 2017 version.
Answer by srmojuze · May 18, 2015 at 09:53 AM
As of Unity 5.0 1f1, for the STANDARD shader, the proper syntax is Javier_8's, for example: GetComponent().material.SetColor ("_EmissionColor", Color.red); Cheers!
Your answer
![](https://koobas.hobune.stream/wayback/20220613064614im_/https://answers.unity.com/themes/thub/images/avi.jpg)