Download

Best blueprint to use to store variables?

Hello!

I have some static int variables I would like to store inside a blueprint to be called within a widget. What is the best practice on where to store these variables?

Depends, what interacts with these variables besides the widget? Is there an issue with storing it in the widget BP instance itself?

I think some of these widgets will need be to accessed and potentially changed at some time, so I think storing them in the widget BP would be an issue.

Maybe you can store them in the Game Instance.

+1 to Mr. Wood. If you’ll need to access these from any BP across levels, this is a good option.

Yeah, Game Instance is the preferred choice.

You could also create an actor bp with the variables and place it in the map. You can reference it via “get all actors of class” from just about any other class. Game mode, level bp, character etc.

I’m using this approach as a prototype config for a BR mode where each map has different settings the game mode needs to reference.