Data table generation with scripting?

Hi! I want to capture data during gameplay and store as an actual ASSET to be used on packaged versions and I wonder what is the best way to achieve this? I can easily store on a savegame but savegames cant be later used as actual assets in the editor so cant be embeedded in the packaged game.

Is there a way to script-create a data asset from scratch using editor utilities?
I’d love to 1st store the data in some savegame and then use some scripting to turn the saved data into data table asset…I think there is a way to write a CSV file and then import that as data table…is there a better workflow?

Thanks!
Dany

1 Like

Ok making the CSV and then import is not that bad so this is the
test i did:

1 - create myCustomStruct struct with the fields of the CSV, in my test I just added a single
struct with one column titled ‘data’ of integer values

image

2 - create a test loop that generates an array of strings.

first item must hold the column names so as I have only one I
just add → ,data ← as first item of the array…note the comma at the beginning because
first column of the csv is for the ‘row name’ so I keep blank…ion that column I will add
index numbers. then I just add strings in the loop making random integers
when the loop ends It saves the csv file with victory plugin ‘File IO Save String Array to File’

3 - the file was created…I drag and drop the file into the editor and select myCustomStruct as format

done! :slight_smile:

image

The asset was created