How would I save this kind of data?

Hello, I’m quite stumped here,

I am currently making a car game. In this car game, the user can choose between a variety of cars BUT ONLY IF HE’S PURCHASED THIS. Assuming I already have an ingame-currency system setup, how would I store data about what cars a player has purchased or not?

In the past, I made a SaveGame blueprint. In this blueprint, I had a Map variable (dictionary) called VehicleLog. In this data structure, I have a string-key which represents the vehicles named, followed by a struct-value. This struct stores a boolean called “isPurchased?” and a CLASS reference to it’s respective blueprint for spawning in.

Then, everytime I load the game, I have my gameinstance store whatever is in the SaveGame file.

Currently, this approach is tedious. What if I want to add more vehicles later on? I would have to go to the SaveGame and add to it’s dictionary.

What I tried to do before is create a DataTable to model this. Unfortunately, UE4’s DataTables are read-only, so that’s unfortunate.

What’s another way I can represent this data, such that this proposed method could easily be updated and modified. I’m thinking about using SQL, but doesn’t that require an internet connection to a Web Service? This game should be offline available too.

i think you just need a function “AddCar” this function will help you add another car into the Map,it will generate a string-key value and insert the value into map.

This would imply that I’m trying to add more cars in runtime which was not was I was asking sorry haha. I’m basically just trying to make a database of vehicles that a player can purchase. I don’t think I have been doing it correctly though. My SaveGame class served to be my container for all this data, and I did this by using a dictionary. Unfortunately, if I wanted to add more cars, I would have to recompile the class. I feel like this isn’t the correct approach.

there is a sql plugin,GitHub - marshal-it/UE4-Sqlite3-Plugin: Reupload due to repo issue you can try that! no need network

My employer had the same problem, so I developed this for us:

However, you say you don’t need to save that data in runtime, so I don’t think a SQLite database is needed.
You are most likely looking for how to use Data Assets in C++:

Or using the SingleTon object class: