# How would I save this kind of data?

**URL:** <https://forums.unrealengine.com/t/how-would-i-save-this-kind-of-data/421550>\
**Category:** Blueprint\
**Tags:** data, unreal-engine, UE4, CPP, Blueprint, question\
**Created:** [April 1, 2018, 10:33pm UTC](https://forums.unrealengine.com/t/how-would-i-save-this-kind-of-data/421550 "2018-04-01T22:33:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nerdares](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nerdares](https://forums.unrealengine.com/u/nerdares)\
**Post date:** [April 1, 2018, 10:33pm UTC](https://forums.unrealengine.com/t/how-would-i-save-this-kind-of-data/421550/1 "2018-04-01T22:33:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_8048583d1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_8048583d1](https://forums.unrealengine.com/u/anonymous_user_8048583d1)\
**Post date:** [April 2, 2018, 2:41am UTC](https://forums.unrealengine.com/t/how-would-i-save-this-kind-of-data/421550/2 "2018-04-02T02:41:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![nerdares](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@nerdares](https://forums.unrealengine.com/u/nerdares)\
**Post date:** [April 2, 2018, 5:57am UTC](https://forums.unrealengine.com/t/how-would-i-save-this-kind-of-data/421550/3 "2018-04-02T05:57:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_8048583d1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_8048583d1](https://forums.unrealengine.com/u/anonymous_user_8048583d1)\
**Post date:** [April 2, 2018, 8:35am UTC](https://forums.unrealengine.com/t/how-would-i-save-this-kind-of-data/421550/4 "2018-04-02T08:35:54Z")

</div>

there is a sql plugin,[GitHub - marshal-it/UE4-Sqlite3-Plugin: Reupload due to repo issue](https://github.com/marshal-it/UE4-Sqlite3-Plugin) you can try that! no need network

---

<div class="post-metadata">

**Author:** ![BrUnO\_XaVIeR](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/bruno_xavier/32/1110230_2.png) [@BrUnO\_XaVIeR](https://forums.unrealengine.com/u/BrUnO_XaVIeR)\
**Post date:** [April 4, 2018, 2:21pm UTC](https://forums.unrealengine.com/t/how-would-i-save-this-kind-of-data/421550/5 "2018-04-04T14:21:47Z")

</div>

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++:  

> **[UE4 C++ Data Assets](http://www.levelplusgames.com/ue4-c-data-assets/)**
>
> Today, I would like to write about the engine we are using in our new project, and that would be Unreal Engine 4. We've been experimenting with the engine lately to learn all of its features, and today I discovered...

Or using the SingleTon object class:

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...
