What is the best way to share an array between all blueprints?

I basically want a global array. I’ve seen some ways to communicate between blueprints, but what’s the best way to do this?

Hi Breakobs,

There are no global variables, as mentioned. However your approach depends significantly on what you are attempting to do. If you just need variables that you can set for each instance, you can create a struct that contains the variables you need. If you need variables that affect other blueprints, you can use casting to affect the individual variables within a specific blueprint. Can you be a bit more specific on what you are attempting to accomplish? Thank you!

There no global variables in UE4, only way to make variable more global is to place in to class that is instantieted to one object in gameplay, like GameMode for example depending on your array role. When you place it to specific class you can access it from any node that can let you access specific object of class, in case of GameMode it will be “Get Game Mode”, just remeber to cast it to you GameMode class so you will be able to access your array from your class

Ok, I see. What would this look like in Blueprint?

I have an array for my inventory (Class Actors), and I wanted to check my inventory array and alter it from several different classes.

Hi Breakobs,

For something like that, casting is the way to go. You can cast from the class checking the array to the class that the array is in, then from the cast you can access the array and alter/arrange its contents as needed.