Download

Communicating between blueprints

I know there is alot of guides for this and they all do the same. What I want is for a blueprint to send information (like a bool) too all blueprints in the level that are have the same refference.

Here is an simple example: One blueprint is the lightswitch which changes variable “lights_on/off” when using button E. Now I want another blueprint with a pointlight to get that information. So in the level editor when I copy that light blueprint many times the switch blueprint will always turn on every light.

In all the guides I have found, you have to target each of the pointlights blueprints that has been made. Would it be possible to communicate without defining which copy it is of the pointlight blueprint since all of them have the same codes. Like with prefabs in UDK.

I also think I have a method where you need to send the codes through the level editor blueprint, but I would love to have an solution without.

Thanks for all help!

You can use a Get All Actors Of Class node and a ForEachLoop to turn off every light when the player uses the switch.

If you make an actor variable editable, I think you are able to select something in your scene as the value for that variable. Fill an array this way and do the for each loop as said above.

The Get All Actors Of Class node and ForEachLoop worked great. thanks!

While Get All Actors of Class Node works.

Why not get references for all the lights, put them into an array, and then use that array to turn off all the lights?

The reason being is that Get All Actors of Class node is high in performance cost.

I am just thinking off problems where you have like over 100 lights or other examples where it would be easier to just reffere too all of them. I guess you have to make a list with the arrays. Also suddently I want to add an light instead of adding too arrays I could just copy another pointlight blueprint. Not sure what you think is the best solution?

There’s no need for any of these. Simply use blueprint interfaces and broadcast event from the switcher.
Every light actor with the interface implemented will receive the event.

Can you make an easy image of it or a little bit more explaining. Would help alot thanks!

any tutorials on how to do that?