- Home /
Question by
FabTastic · May 19, 2020 at 05:14 PM ·
scripting problemscript.lightemission
Change emission with script
Hello,
Some time ago I wrote a script which should switch on the light, it changed the emission color. In the meantime I switched to Hdrp and as expected the script doesn't work anymore...
Does anyone know how I could fix the script? I'm really desperate, google didn't help me either.
Many thanks in advance !!
Best regards
foreach (var material in meshRenderer.materials)
{
if (lightObj.enabled)
{
material.SetColor("_EmissionColor", new Color(1f, 1f, 1f));
}
else
{
material.SetColor("_EmissionColor", new Color(0f, 0f, 0f));
}
}
}
}
Comment
Your answer
Follow this Question
Related Questions
How do I slow down while Im Sliding? 0 Answers
How can i get raycast hit from a specific gameobject ? 1 Answer
Need help fixing my script 1 Answer
How can i make an object to rotate in a circle smooth around another object nonstop ? 2 Answers
Why when destroying objects when quitting the game it's destroying the objects only in hierarchy ? 0 Answers