Why Use Data Assets?

Hey everyone,

As far as I know, A data asset is just a collection of variables. A struct is also a collection of variables. Why would I use either when I can just add the variables to the class? No one has ever actually explained that to me.

Data assets allow you to have a bunch of different sets of VALUES for those variables saved in the editor as assets.

Say you had an RPG and you wanted to have different weapons. They all work the same but have different stats (damage, crit rate, mesh, weight etc.). You could make a data asset that represents an individual weapon. Now, whenever someone wants to add a weapon to your game (you or another dev) they can just make a new data asset.

1 Like

I guess the reason that confuses me is because they would achieve the same result by just making another blueprint class, right?

So you’d have a weapon parent class and a sword class. If you want a new sword, just make a child of the sword class. Correct?

1 Like

Yes, that is also a fine way to solve that problem. Data assets just let you separate those values from the actual blueprint class, which can be useful in some situations.

Data assets can’t be extended with new variables and functions, so if you are going to have a lot of instances of something and you want to guarantee that they are all uniform, data assets are a good use for that.

Data assets also let you more easily SHARE values between blueprint classes, without those blueprints having to share the same parent class.

4 Likes

I suppose that makes sense. They seem much more useful in giant projects then.

Yes, definitely more useful when you are going to have a LOT of instances of something with set parameters and will likely be adding more in the future.

I suppose that makes sense. They seem much more useful in giant projects then.

You’re absolutely right, and if I may expand on that: a lot, and I mean a LOT, of what you’ll find in tutorials around the internet - especially in YouTube tutorials aimed at beginners that are showing off a specific piece of functionality in isolation and aren’t part of a larger game project - doesn’t always scale very well when you start talking about anything bigger than very small, simple games. That doesn’t mean you can’t learn from them, but it’s good to understand that something that works fine when you’re only doing it once or twice might get really hard to manage or perform poorly when you’re doing it hundreds of times.

1 Like

I was working recently on a project with a lot of data assets (it was a big project indeed, haha), and one big, big difference hit me - you can edit data asset when playing, so if the data is supposed to be iterated a lot it is truly convinient to not be forced to click Play, check values in gameplay, notice it’s slightly off, ESC, change values, click PLAY again and so on.

8 Likes