How do you make 'Global' variables?

@ClockworkOcean I don’t think that pointing newbies towards 30$ plugin is a good idea, especially when it teaches them bad practices.

@Engelard Generally in Blueprints you will always need to reference something in order to achieve this. You could wrap those nodes in something like Blueprint Macro Library, but it would really create just a bigger mess. When it comes to which Class should be used, take a look at Gameplay Framework and pick something that is persistent across levels. “UGameInstance” is probably the best as it lives throughout whole lifetime of the Game, but I’m not sure if you can use it from Blueprints.

In C++ the best ones for this are Subsystems

Though, I agree, global variables are bad idea, especially when you mutate them in multiple places. That said you probably need to try them first to understand why :slight_smile:

3 Likes