# Data Asset and Save Game

**URL:** <https://forums.unrealengine.com/t/data-asset-and-save-game/510533>\
**Category:** Blueprint\
**Tags:** unreal-engine, UE4, Blueprint\
**Created:** [March 29, 2022, 6:40am UTC](https://forums.unrealengine.com/t/data-asset-and-save-game/510533 "2022-03-29T06:40:52Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cissoid](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Cissoid](https://forums.unrealengine.com/u/Cissoid)\
**Post date:** [March 29, 2022, 6:40am UTC](https://forums.unrealengine.com/t/data-asset-and-save-game/510533/1 "2022-03-29T06:40:52Z")

</div>

Hello,  
I made some DataAsstes for Pickup Items. My inventroy has an array of dataassets.  
If I wand to save the character, will it work or do I need an extra class for the inventory with the  
same attributes like the data asset and copy the data to this class?

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [March 29, 2022, 7:10am UTC](https://forums.unrealengine.com/t/data-asset-and-save-game/510533/2 "2022-03-29T07:10:31Z")

</div>

You’ve just discovered the problem with data assets. You can’t save them.

Unfortunately, you have to convert to structs and put them in the save game… :-/

---

<div class="post-metadata">

**Author:** ![Cissoid](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Cissoid](https://forums.unrealengine.com/u/Cissoid)\
**Post date:** [March 29, 2022, 7:28am UTC](https://forums.unrealengine.com/t/data-asset-and-save-game/510533/3 "2022-03-29T07:28:34Z")

</div>

Ok, as i thought. But strange that they don’t have a nice solution for this kind of data.  
Datatables are also crap.

---

<div class="post-metadata">

**Author:** ![midgunner66](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/midgunner66/32/466711_2.png) [@midgunner66](https://forums.unrealengine.com/u/midgunner66)\
**Post date:** [March 29, 2022, 7:33am UTC](https://forums.unrealengine.com/t/data-asset-and-save-game/510533/4 "2022-03-29T07:33:29Z")

</div>

You can save them, just tested it.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [March 29, 2022, 7:46am UTC](https://forums.unrealengine.com/t/data-asset-and-save-game/510533/5 "2022-03-29T07:46:04Z")

</div>

I’d love to be wrong, can you show that?

I can only save a reference…

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [March 29, 2022, 7:49am UTC](https://forums.unrealengine.com/t/data-asset-and-save-game/510533/6 "2022-03-29T07:49:39Z")

</div>

I think structures are supposed to be it, but they’re very unwieldy… ( in blueprint ).

---

<div class="post-metadata">

**Author:** ![midgunner66](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/midgunner66/32/466711_2.png) [@midgunner66](https://forums.unrealengine.com/u/midgunner66)\
**Post date:** [March 29, 2022, 7:51am UTC](https://forums.unrealengine.com/t/data-asset-and-save-game/510533/7 "2022-03-29T07:51:36Z")

</div>

> [@ClockworkOcean](#):
>
> I can only save a reference…

Yeah, that’s what I mean. If you’re trying to save modifications to that (like changing a variable in the data asset), it’s not going to work (or at least not the way it’s supposed to).

Here’s what I’m doing.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/0/7/e07522a2378ae7db6403f522f66163fa4f216995.png)

* * *

Edit: If you change a variable in the data asset through blueprint, it will modify the asset itself (the editor asset). Don’t know what will happen in a packaged game, but it shows it just saves the reference.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [March 29, 2022, 7:51am UTC](https://forums.unrealengine.com/t/data-asset-and-save-game/510533/8 "2022-03-29T07:51:45Z")

</div>

Ok, wait. I was talking about objects ( yet another way of doing this ), but I assume data asset is similar…

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [March 29, 2022, 7:58am UTC](https://forums.unrealengine.com/t/data-asset-and-save-game/510533/9 "2022-03-29T07:58:23Z")

</div>

Yes, and that’s the problem. What’s the point of having this great way of managing data/object/assets, if you can’t save it?.. 🫠

---

<div class="post-metadata">

**Author:** ![midgunner66](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/midgunner66/32/466711_2.png) [@midgunner66](https://forums.unrealengine.com/u/midgunner66)\
**Post date:** [March 29, 2022, 8:02am UTC](https://forums.unrealengine.com/t/data-asset-and-save-game/510533/10 "2022-03-29T08:02:27Z")

</div>

I think they intended data assets for static data (items, weapons, enemy stats, etc.), then use structs for runtime data (health, modifications, etc.).

---

<div class="post-metadata">

**Author:** ![Cissoid](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Cissoid](https://forums.unrealengine.com/u/Cissoid)\
**Post date:** [March 29, 2022, 8:58am UTC](https://forums.unrealengine.com/t/data-asset-and-save-game/510533/11 "2022-03-29T08:58:17Z")

</div>

Ok but i wouldnt use structs, the cool thing about data assets are that you can derive.

I have a base data asset and then different kinds of items based on the base asset.  
Or do i have to make one big merged struct to save data?

---

<div class="post-metadata">

**Author:** ![midgunner66](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/midgunner66/32/466711_2.png) [@midgunner66](https://forums.unrealengine.com/u/midgunner66)\
**Post date:** [March 29, 2022, 9:09am UTC](https://forums.unrealengine.com/t/data-asset-and-save-game/510533/12 "2022-03-29T09:09:08Z")

</div>

No, you can just save it directly. Remember, it’s just saving a reference to the data asset, not the data inside it.

---

<div class="post-metadata">

**Author:** ![Cissoid](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Cissoid](https://forums.unrealengine.com/u/Cissoid)\
**Post date:** [March 29, 2022, 9:21am UTC](https://forums.unrealengine.com/t/data-asset-and-save-game/510533/13 "2022-03-29T09:21:26Z")

</div>

Ok, maybe we missunderstood. I have a character inventory.  
I have PickupItems in the world, there i can assing DataAssets, maybe a box of bullets with 20 bullets.

Now i store the data asset in the inventory. Now maybe i reload the weapon and 10 bullets left.  
If I save the reference to the asset, will mean i have the initial value of 20.

So i seems i need to copy the data to save it.  
It should work if i do the same class structure and save it.

i have  
class LOSTSIGNAL\_API UItemDataAssetBase : public UDataAsset  
class LOSTSIGNAL\_API UWeapon : public UItemDataAssetBase

I would make new classes  
UItembase : UObject  
UWeaponItem : UItembase

with the same properties like the data asset and store an array of Itembase instead of UItemDataAssetBase.

---

<div class="post-metadata">

**Author:** ![midgunner66](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/midgunner66/32/466711_2.png) [@midgunner66](https://forums.unrealengine.com/u/midgunner66)\
**Post date:** [March 29, 2022, 9:34am UTC](https://forums.unrealengine.com/t/data-asset-and-save-game/510533/14 "2022-03-29T09:34:17Z")

</div>

> [@Cissoid](#):
>
> Ok, maybe we missunderstood.

Yeah, that’s the case. DataAssets are just editor assets that store data; they are just assets, not runtime “containers” like structs are. If you need to save ammo, etc., you need a struct.

---

<div class="post-metadata">

**Author:** ![Cissoid](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Cissoid](https://forums.unrealengine.com/u/Cissoid)\
**Post date:** [March 29, 2022, 9:43am UTC](https://forums.unrealengine.com/t/data-asset-and-save-game/510533/15 "2022-03-29T09:43:20Z")

</div>

Ok, but really a struct or does it also work with classes.

---

<div class="post-metadata">

**Author:** ![Cissoid](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Cissoid](https://forums.unrealengine.com/u/Cissoid)\
**Post date:** [March 29, 2022, 10:05am UTC](https://forums.unrealengine.com/t/data-asset-and-save-game/510533/17 "2022-03-29T10:05:13Z")

</div>

Ok isnt an Actor, my base class is UObject in Blueprint i would create an instance of this class and  
copy the data. The serializer hopefully grab all public members and store them.

I’ll try this but have to restructure a bit, will take a while 🙂

For level save it saves the reference of the actors on loading the Level i destroy all actors in the list, this works fine.

---

<div class="post-metadata">

**Author:** ![midgunner66](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/midgunner66/32/466711_2.png) [@midgunner66](https://forums.unrealengine.com/u/midgunner66)\
**Post date:** [March 29, 2022, 11:03am UTC](https://forums.unrealengine.com/t/data-asset-and-save-game/510533/18 "2022-03-29T11:03:27Z")

</div>

> [@Cissoid](#):
>
> Ok isnt an Actor, my base class is UObject in Blueprint i would create an instance of this class and  
> copy the data. The serializer hopefully grab all public members and store them.

Ok, I just dropped in this thread cuz I was like “yeah, you can save (references to) data assets,” but unaware you meant saving variables inside of them. I haven’t messed with saving outside blueprint savegames, so I haven’t touched anything dealing with saving in C++.

* * *

But with the DataAsset stuff… (If this is hard to follow, sorry, I’m sleepy.)

There was a misconception that DataAssets are for storing (runtime) gameplay data; they’re not, they’re just for storing asset data (e.g. storing the stats of a weapon, but **not** the current ammo count of it).

If you want to store ammo in your inventory, you need to use an array of stucts that stores the DataAsset and the ammo:  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/e/5/4e56739750aec98e003aace9099c7be606864943.png)

In this example, I store the item and an ammo counter. The ammo counter is called “AmmoUsed” which is how much ammo has been used from this item. The item itself stores the max ammo, so to get the amount of ammo left, you do `Item.MaxAmmo - AmmoUsed`.

The item in this example can be anything: an ammo box, a magazine, or a weapon; it doesn’t really matter. All we’re saying here is that “this is the item, and this is how much ammo has been used.”

It’s also important to note that “Item” here is not the instance of the item, but its “type” (i.e. what it is and information about it) (e.g. {ammo box, 100 rounds}, {magazine, 30 rounds}, etc.). The struct in the inventory array is the instance. So if you add two of these to an array with the same item, you would have **two** instances of the **same** item, but with separate ammo counts.

* * *

So, in your case with pickups, your data asset would store things like:

- Mesh
- Max Ammo
- Particle Effect
- Pickup & Drop Sound

The pickup actor would only store the struct above (DataAsset & AmmoUsed). In the pickup’s BeginPlay, you would set the mesh & particle effect. When you pick it up, you would play the pickup sound. When you add it to your inventory, you add it using the struct above [like this](https://forums.unrealengine.com/uploads/short-url/yOb8cKHkojMKUd5xLIZKtkzjZXC.png). When you use the item, you add to “AmmoUsed” (which subtracts from the ammo count). When you drop the item, you would play the drop sound, spawn a pickup actor, and set its struct [like this](https://forums.unrealengine.com/uploads/short-url/mrcE1GrzZ7lV0piErGylUctV2Xl.png); the pickup’s BeginPlay will handle setting the mesh & the particle.

---

<div class="post-metadata">

**Author:** ![Scoly1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Scoly1](https://forums.unrealengine.com/u/Scoly1)\
**Post date:** [November 6, 2023, 6:38pm UTC](https://forums.unrealengine.com/t/data-asset-and-save-game/510533/19 "2023-11-06T18:38:56Z")

</div>

Hey, I know it’s a bit old topic.  
But if I create a DataAsset that stores in it a struct, would that struct be able to change during runtime and be saveable?

---

<div class="post-metadata">

**Author:** ![Auran131](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Auran131](https://forums.unrealengine.com/u/Auran131)\
**Post date:** [November 12, 2023, 3:41am UTC](https://forums.unrealengine.com/t/data-asset-and-save-game/510533/20 "2023-11-12T03:41:23Z")

</div>

if you mean change a struct in a dataasset yes you can but be aware this will affect all references to the dataasset

if you mean save a data asset in a struct then also yes you can

---

<div class="post-metadata">

**Author:** ![AdamDodgen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AdamDodgen](https://forums.unrealengine.com/u/AdamDodgen)\
**Post date:** [November 11, 2025, 4:12am UTC](https://forums.unrealengine.com/t/data-asset-and-save-game/510533/21 "2025-11-11T04:12:32Z")

</div>

I’m late to the party but I did a quick test myself using my “VehicleLoadoutPreset” struct, which contains a primary data asset object (hard) ref property of my data asset type (DAI\_Vehicle).  
I was able to save the struct with my vehicle data asset and load it just fine. It seems like data assets, even hard references, are safe to save, as well as save inside structs.

[Next page](https://forums.unrealengine.com/t/data-asset-and-save-game/510533.md?page=2)
