Hello, I hope to read and change the properties of each light in Window > Rendering > Light Explorer > Lights from scripts. Is there a way to do this?
I am a beginer to unity, so please forgive me if this is a naive question.
Thanks!
Hello, I hope to read and change the properties of each light in Window > Rendering > Light Explorer > Lights from scripts. Is there a way to do this?
I am a beginer to unity, so please forgive me if this is a naive question.
Thanks!
Yes. Get all the lights in your scene and modify them as you wish:
// Get all the lights in the Scene
var allLights = FindObjectsOfType<Light>();
// Cycle through all lights
foreach (var light in allLights)
{
// Set color to a yellowish one (red=1, green=1, blue=0.88, alpha (transparency)=1)
light.color = new Color(1f, 1f, 0.88f, 1f);
// Dim light by 30%
light.intensity *= 0.7;
}