Download

Adding lights automatically ?

Hi,
I’m new to the forum and unreal but have been lighting in film for many years, so forgive me for noob questions and using the wrong terminology which I’m sure to do.

I’ve been given a level (interior) to light and was wondering if there’s a way to script (BP) a light, like a spot light to every light fitting in the level using naming conventions perhaps? I’m pretty sure this has been asked many times before but I had no luck in searching for it.

Can the hive mind help a guy out please.

If every light fitting is it’s own mesh then you could make an array of all of those lights using tags. Assuming that the pivot is shared across all meshes in the scene (often the case with pre-made scenes being ported to UE4) you’ll have to get the bounding box of the mesh and offset your lights from there. You’ll have to use the blutility system if you want to do this in-editor rather than at runtime.

The function would probably go something like this:

“Get all actors with tag (Light) -> ForEachLoop -> get bounding box -> split -> get position -> (add your offset) -> spawn point light.”

Just quickly tested this and it works. (first time actually doing a blutility graph)

Here’s the blueprint: Spawn Lights > BlueprintUE.com | PasteBin For Unreal Engine 4