Transferring variables between blueprints.

Okay, I am confused as hell by how to do this… I think Unreal’s systems for transferring data between blueprints are extremely confusing considering how simple this should be…

I want to do the following:

I have a graph running on an actor that I placed in my level. I’ll call this my Game Controller. This script does some calculations, and generates a variable that will be used by various other objects in the game.

I want to be able to transfer this variable from this Game Controller to other actors.

I tried to use blueprint interfaces, but I’m not sure what is the sender, and what is the receiver… Is it the Game Controller that is the sender (i.e. sending the data), or is it the other object (i.e. sending a request for the data)? Where do I implement the interface? On the Game Controller, or on the other object that needs to receive the variable? Or on both?

Is there a better way to communicate these variables?

I’ve managed to figure out direct communication between colliding objects, but this is still confusing me after a week or so…

you implement the interface in any BP that will use the variable

to use it

make a function in the interface (mine is called action and it passes a string called Command for example)

in your game controller you would have a reference to the actor you want to call the interface function on (in my example i use a trace to get it), from there you use the interface function (message) to send the call to the receiver:


and in the receiving BP you handle it via the Event interface function:

im not good at explanations so it helped >_<

as for better ways depends on many things (are the objects spawned into play or are they always there from the start and etc)

Hey, thanks for the help! :slight_smile:

This is using collision again to get the actor reference though, right?

You’re using a trace to get your reference to the actor that uses the transferred variable, but I’m not able to use this… there is no collision in what I’m trying to do!

I have an invisible object that sits somewhere in my level calculating variables, and I want to transfer these variables to another object that never touches it…

I can’t understand why there is no ability to simply “broadcast” a variable globally within a level - I read that this used to be a feature in Unreal Engine, but was removed because it was inefficient.

way simpler than it looks for many cases - if you can just get a reference to the actor you want to access

For example, use GetPlayerPawn (0) will get the Actor for the current player. You can then cast it to your specific Character and access it.

Another example, GetGameMode, Cast To MyGameMode, access its properties and functions.

Okay, here’s my Interface.

And this is on my Receiver.

I want to be able to feed a variable into the interface, and have it pop out in the graph on my receiver.

I have implemented the interface on both my Game Controller and Receiver.

How do I do this?

Hey, OptimisticMonkey.

In this specific case, how would I get a reference to my GameController?

Please bear in mind that these objects do not collide.


You can use the Get Controller node.

Another common pattern is to cast the result of an OnOverlap or OnHit to the desired object.


I think you are making this harder than it is. There is no need to broadcast, generate or send a variable. Set a variable of the same type as it to equal it. If Interfaces confuse you, you don’t need to use them, just make the variable and any other object can have access to it.

The reason you are having a hard time is because you just stick the Actor in the level.

You can instead spawn it from your level blueprint, and keep a reference to it, maybe set it in your gamemode class, or gamestate class, you can get a reference to those from anywhere.

Or, use the get all actors of type node and use the first one, that is if you know you only put one.


Hey, thanks again.

In my case, the blueprint I’m trying to get a reference to isn’t the player - it’s just “a random actor in the level”.

Is there any way to get the reference I need if it’s not one of these special cases?


If I spawn the Game Controller, then the only thing that would have a reference to the game controller (i.e. what I need) would be the spawning entity, right? I’ve used this elsewhere, and it works… But I need to be able to read the variables that are contained in the Game Controller from various other entities.

If I use the “get all actors of class” node, I get an array… How do I take the reference that I need from this array?


2 things here.

When you spawn it you get a reference to the object. If you have made your own GameState class, extending GameState make a variable on it of the type of your controller. In the place you spawn the controller, get gamestate, cast it toyour type and then set the variable to the new controller you just spawned. For the rest of the level the GameState will now have a reference to the controller. It will reset when the level changes.

It’s an Array yes, but if you only have one instance of the controller then there will only be one item in the Array, so just take the one at index 0. This is hackier, but it will work. The method of storing it on a GameState, GameMode, or GameInstance would be better.

Just to clarify for all you people who are trying to help me (and I appreciate it… thank you!) this is what I am trying to do…

Please note that **these objects do not collide **- so I can’t get references through the “on actor overlap” logic.

I’ve been through numerous tutorials, read numerous guides - and while there seems to be plenty of information on how to handle interaction between colliding actors through traces, overlap, etc, I can’t figure out how to do this…

Keep a reference to it at spawn, that’s all you have to do.

I hope I’m not hijacking this thread, but I figured if someone’s having a very similar issue as me, I don’t need to make an extra one.

Basically, I’ve gleefully stolen someone else’s blueprint example to create a grid array of vectors, which then spawns a static mesh at each point in the array. Fine and dandy, but I’d like other actors to be able to reference this array so that they can move to certain indexes, or place objects there, etc. How would I go about referencing this array in other actors?


Calamity_Jones - the attachment is not opening for me…

But as mikepurvis said - if you are spawning it and wish to reference it later, then you can keep it in a variable and simply reference it.

If it is some other unrelated actor, you need a way to identify it in order to get a reference to it.

GetAllActorsOfClass can quickly give you all the actors of a class, but you will still need to determine which one you wish to reference.

hey guys, I appreciate the help!

I seem to have a system that works now, using the get actor in class command, and then taking the item I need from the array.


I understand that using this system is quite slow, right? With the setup that I have in the image above, am I right in saying that the “get actor in class” is performed at game start… And with every tick the engine simply gets item 0 in the array?

You can just store a variable reference to the actor in begin play and reference in the tick.

BTW - GetAllActorsOfClass actually performs quite well - the engine keeps a HashTable for each class and uses that at runtime. I wrote a blog article on it: