Hi, I found how we can use data table, but I also want to make update it and save it. For example I have a data table like below. [TABLE=“border: 1, cellpadding: 1, width: 500”]
Name
Color
width
Owner
Box_01
Blue
20
Adam
Box_02
Green
30
Ben
I can create a box with different color, width and owner. I want to update the data table and store it like… [TABLE=“border: 1, cellpadding: 1, width: 500”]
DataTables are read-only data, they are not designed to be used as a database.
Last time I checked there’s no way to update a DataTable outside the UEditor, but has been a looong time since I’ve used them so not sure anymore.
If data tables are still read-only, i’ve just wasted my day and possibly months ; )
I was so happy i’ve 100% understood how they work, how to setup different things in my project, easily and elegantly, with interactive tables updating, saving and loading for the player.
Save game would mean constant access to disk just for my step sequencer. I don’t know how to deal with arrays for now, and i’m going first check if structures are writable in game already.
I was really hoping for a better answer here. Savegames are currently giving me issues where they can be loaded from but not saved to and not deleted which is very frustrating. No one else seems to have this issue and I’ve gotten no responses on any post I’ve made about them.
It also has Google Sheets support so you can edit a Sheet and see your changes propagated to your game live during runtime. You can also use a text CSV on your local machine if you prefer so you can read and write using a local data table.
the engine now seems to support load/save to csv/json
this is available on 5.1 at least but not sure if it’s on previous too.
also
You can save your data table from cpp.
call
FDataTableEditorUtils::BroadcastPreChange(DataTable, FDataTableEditorUtils::EDataTableChangeInfo::RowList);
you can get the rows using DataTable->GetAllRows and you get some pointers.
you can modify them.
or you can add rows using DataTable->AddRow
at the end you need to call DataTable->Modify()
then
UEditorLoadingAndSavingUtils::SavePackages({DataTable->GetPackage()}, false);
then
FDataTableEditorUtils::BroadcastPostChange(DataTable, FDataTableEditorUtils::EDataTableChangeInfo::RowList);
credits goes to “Authaer” who told me this after some time of searching
it was specified on the next line.
i haven’t tried on 4.27 but would not be surprised if it’s not supported.
check the source code for 5.1 maybe you can backport it.