How do you make 'Global' variables?

You can make functions in function library, and store that “Global” variable in game mode or game instance.

First make bp game mode and your variable inside of it:

  • variable declaration in BP_Game_Mode (create this blueprint based on game mode class, add variable)
    my global variable

Second, make Blueprint Function Library. And make those 3 functions inside:

Third, how to use it or THE RESULT. This works in ANY blueprint, just like variable that is global.

ps.
Quite Important: SET that variable only from SINGLE place, and everybody else reads it only.
If you start setting this variable from different blueprints you may get weird results, because you cannot be sure which place set it last. It is very easy to mess things up, unless you only care about most recent value.

2 Likes