Put a static light in a blueprint, randomize it's color and intensity though construction script, use it thousands of times?

I made an actor blueprint containing a single streetlight static mesh, and a single static spotlight. I duplicate the spotlight blueprint thousands of times though my city level. In the construction script, I randomize the color and light intensity so it’s not so repetitive. This works no problem, I bake lighting and that also works. I save my scene and re-open and all my lighting needs re-baked because it’s changed the intensity and color of every light, invalidating the last light bake. So I try this again but after baking I unhook the construction script. Save, reload and all my lighting needs rebaked again.

So how do I randomize the intensity and color of thousands of instanced streetlight blueprints and keep my static lighting though loads and level restarts? Thanks.

After light building, set light source Mobility to Movable and disable it in the blueprint.

My Products

1 Like

You could store the generated values into a table > save the table then reload it so it the same every time unless you want it be randomized again.

1 Like

It’s static lighting :wink:

However, after light building, we can change it to movable, which won’t affect a baked scene.

Thanks for this idea and I got it to work. I can automate the mobility setting, but it appears that the “Affects World” checkbox is not controllable though construction script blueprints. There is a function called SetLightFunctionDisabledBrightness, but that does not seem to disable the light like “Affects World” does. So this would be a manual process every time I want to bake lighting correct? Or am I wrong and there is a way to disable the light in the blueprint? Thanks again.

You could add a light component dynamically:

Then after baking, disable the condition, and the light component won’t add.