Hello…
im trying to change an emission color from scripting by this way:
[SerializeField]
private MeshRenderer myPlayerRender;
private void Update(){
if (Input.KeyDown("z"))
ChangeEmissionColor(Color.red);
if (Input.KeyDown("x"))
ChangeEmissionColor(Color.blue);
}
private void ChangeEmissionColor (Color newColor){
myPlayerRender.material.EnableKeyword("_EMISSION");
myPlayerRender.material.SetColor("_EmissionColor", newColor);
}
Maybe because LWRP ?
There are somethings that are not working on LWRP yet, I’m not sure if this is the problem, or my code is not fine…
Realtime GI is not supported in LWRP according to this blog post: Unity Blog
I would think Emission would still work for the one material, and the lack of GI would mean the light from the emission wouldn’t affect other objects. I can’t find anymore reliable info. Maybe you can try to get it working with a different shader or with the default rendering pipeline as a test.
Good luck!
1 Like
Thanks for your answer…
Yes, indeed, i have made a test with standard pipeline rendering, and works!, so i only can conclude that it is because LWRP WIP…
1 Like
I have the same problem with lwrp:
SetColor("_Color" Color.green);
What’s the shader name/nameID used in lwrp/Lit shader?
Any fix for this yet for the LWRP?
I have the same problem with:
MeshRenderer.materials[0].color = color;
IAmChiagozie:
I have the same problem with lwrp:
SetColor("_Color" Color.green);
What’s the shader name/nameID used in lwrp/Lit shader?
they changed _Color to _BaseColor
5 Likes