As mentioned in the title, I’d like to create a switch button (or more), in a room, to turn on/off all the lights relied to the button.
For the moment, as you could see in the images below, i have to create a new blueprint for each light and make the same paths.
There’s certainly a better way but i just began to learn the Unreal Engine a few days ago.
Actually i have another problem (i post it here so its more easy)
I used standards blocks to do the floor while the front windows (those you can see on image below) are .fbx from max with unwrap.
But when i build the scene (medium, high or production), the shadows are blurred and do not match with the elements (as before the build).
If you have any advice…
First off, use only one light blueprint. In your switch blueprint, create an array of the light blueprint you created as a variable (make sure this variable is public and editable). This will allow you to place the switch in the world, and set the lights that are controlled by the switch using the Details panel. Next, in your switch blueprint, add the logic. For example, you can say: if F is pressed, for every light blueprint in the array, toggle them on and off. Hope I helped!
Change all lights. This can be very easily done via “Get All Actors of Class”
Use tags. Pretty much as my first suggestion but instead of just getting all actors create an array and add all actors with a specific tag. You can set them yourself so this would allow you to group them.
Add a box collision which you can modify in position and size. Inside of your event construct get all overlapping actors, check each actor if it’s one of those lamps and if so add it to an array (ideally use an event dispatcher but that’s going to deep for now) and in this event change it for each lamp.
This is actually an interesting enough issue that I might do a video. Just tell me which version you think has the best workflow for you and I’ll go a bit more in detail in the video and show how to do it step by step
Oh yea and as said do the logic inside of your switch and only use one BP… I’ll show it to you tomorrow.
I would be interrested by every suggestions to do it.
The more simple maybe
Actually i dont know yet how to manage withs arrays so i will read the documentation about it and eventually if you could make a video that could be great.
To create event either add it as dispatcher or right click in blueprint lamp and “add event” > “add custom event”. Add variables you want to pass over (on the right in red box).
You can add array for colors of lights, intensity and radius. However there is problem with my very simple solution, you never know which order they are in “get all actors from class”.
Very simple solution to this is making separate bp for each group of lights. Or you could add one more integer variable in lamp that says “group number”. Expose it at spawn and make editable.
Then for each lamp you place in level you set that integer number. Then in event begin play instead of index from loop you read that bp_lamp “group number” value, get color from array and apply to light.
Thanks a lot for your answers.
Sorry i could not respond earlier, i had others problems to solve.
I will try your ways to do it and told you if it works.
Thanks again for your time!