Store constant values in Blueprints

Hi!

While I’m developing I want to store these constant values somewhere to easily modify it, instead of looking inside the code where they are:

How can I do it? With a configuration file. With a constant file (if it exists in Blueprint).

Thank you!

Store the variables in the game instance if they need to carry through levels like player life counts and credits etc etc.

Store them in gamemode or the character bp if you don’t care about them getting reset when you change levels.

You can create a simple actor class that you drop in the level and have the GM, GS, GI etc reference. I’ve done this in the past for Levels that have different values for settings. Now I use Data Tables.

1 Like

above suggestions are good. my fav is data tables.

another option are data assets.

alternatively you can also mark attributes as config file available, and then they can be set on the .ini files after packaging. but for this i suggest using a base class.

you can also have a DeveloperSettings class, so that you can set them on the settings, and obtain during runtime.

The values are constant not variable.

1 Like

What do you mean? A blueprint class?

Thank you.

Developer settings and data tables and data assets are the preferred way to store data/config.

This is dev settings Developer Settings · Unreal🌱Garden

I dont recall exactly but you might need cpp. Take a read to confirm.

1 Like

Don’t stress about it. All values except literals have to be stored in variables. Literals are stored in memory anyway.

A variable that doesn’t change is good enough as a constant.

(A nod is as good as a wink to a blind horse, i say)

1 Like

The most convenient way I’ve found to do this in just blueprint is to simply create a function library with pure functions that return the values. They’re easy to access from anywhere that way, without needing any additional nodes.

1 Like

What I meant.