Download

DataTable vs UDataAsset for storing large amount of static data

Hi all,

My game is very data driven, i need to store a large amount of data with the same structure, and i’m stuck between using DataTables with structs, or a UDataAsset object. I’m curious what some more experienced developers might have to say. This is 100% static data that will never change at runtime, it will likely have 10k or more rows.

Is there any pros and cons to using each?

Does one type handle schema changes better than the other without data loss?

I wont need to store pointers to any UObjects, just primitive types and structs!

Any input on your experiences with either is appreciated!

Technically, a Data Asset is typically a single piece of data (or a single struct), so it’s the equivalent of a single row in a Data Table (which uses a single struct as a schema, and can then be filled with all the data. Each row is basically one instance of the struct). If you have a lot of data with the same structure, basically a table/database, I recommend a Data Table.

On top of that, with a little consideration, a DataTable can store references to assets (asset strings) and I believe objects as well (basically any variable type).

As far as pros and cons go, you’re basically comparing apples and oranges AFAIK so there isn’t really any reason to, I think.