Is there a way to create a data asset from a struct?

Hi Folks,

Is there a way to create a data asset from a struct?

I’ll like to create something with variables I can update while the game is running and can have children that can inherit information from the parent like material instances.

These variables should updated any blueprint operations that reference the data asset.

For example: If I have a data asset that says spawn 3 emitters and I change that number to 5 while the game is running, the next time a blueprint fires an event that references the data asset 5 emitters should spawn instead of 3.

1 Like

I think you can do this.
first, create your structure
then create an array from it and config save for it
now in-game first of all load that array and then work on your data for spawn

there are many ways to do that. but i think for your case the best is a “settings” object which holds an instance of said struct.
for example the UDeveloperSettings . iirc there are other types of settings objects.

another option is to make the struct inherit from the appropriate parent (FTableRowBase) and create a data table.
data table can be read and modified at runtime. as well as exported and reimported. and worked by other members of the team (like designers). i love them, but maybe not for your exact case.

another option is to create a blueprint, whose base class is a primarydataasset, and add a variable of the type you want. similar to what the previous person said.
you can then load, and reference that asset, or call getclassdefault.
saving is a bit more difficult. but you can mark the attributes as config.