I want to change the value for the emission from a script, but I am not sure how I can acces that variable and I can’t open the buildt in shader.
2 Answers
2The sources of all built-in shaders can be downloaded from here. From these you can find the names of all uniforms (parameters). I don’t think any have a straight color for _Illum, only textures, but it’s pretty easy to add if you need it (and for that, start with these sources).
Got it,
var emission = 100;
renderer.material.SetFloat( "_EmissionLM", emission );
yep, my script controls a light attached on a prefab model, if the light can be switched on anf off the material should not cast light. But writing this I realize this is not going to work if there are 2 instances of the model and one is flagged to switchable and one isn't as they share the material it will use the setitngs set on the last edited moel :/
– Bluestrike
@crash664. The last 3 lines must be run from a coroutine. The question isn't about running outside a coroutine, it's about getting data from a coroutine you've yielded to. This question generally comes up when you want your coroutine code to be self contained with no "hooks" to other code, but still return a value.
– Ted-Bigham