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);
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.
material.SetColor (“_EmissionColor”, myColor);
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!