How many Variables are too many inside a BP Struct?

The BP JSON plugin can convert a BP Struct to JSON and I planned to use a struct as sort of a “database” for all my settings values. The struct variables are just basic strings (not nested because unsupported by the JSON plugin).

Is UE optimized enough to handle 500+ string variables inside a single BP Struct or do I have to separate them into multiple structs by category?

You will be limited by FString and not variable count. The summed length of the data + quotation marks, commas and curly brackets is really the limit.

Though the longer your string the more calculations will go into parsing / building back and forth between JSON and FString.

Main question is why would you need 500+ variables inside of a single struct? Are you making the right design choices?

Maybe some of this should be split into actors and serialized into a save file?

If you are basically trying to create a database then why not just use one?

You could go the route of a file database via SQLite for something like this (better than datatables because it can be modified at runtime)

Tutorial on using SQLite with Unreal. It’s an external link:

2 Likes

Consider using data assets. Parse Json into data assets, then load one you want.

2 Likes

The JSON plugin only allows conversions from Struct to JSON. UE’s unreliable SaveGame class is the main reason as to why I have to resort to encrypting and saving JSON data to file.

The SQL DB is nice but unless there is a BP plugin. It’s not of much use to a BP-Only user like me.

@Nawrot I’ll look into it. Thanks for the tip.

Sqlite plugin is by default in the engine plugins.

1 Like