How to permanently update/create Uassets in the editor during runtime?

I’ve done some looking around, and I’ve seen some posts about similar topics, but nothing specifically about what I need to do. I am trying to import a massive amount of text via .json format using a plugin to get this info from a RESTful API URL. I can parse the info and everything, but I want to split up this info and store it into custom structures and data tables so that I don’t have to keep calling that API all the time.

My problem is that in order to execute the blueprint script that gets the info, it’s obviously at runtime, and I need it to PERMANENTLY change the values of these tables and structures so that the changes persist in the editor after I stop running it. Importing/Getting the information is not the problem, it’s keeping it.

The absolute closest thing I’ve found to this so far is this 2 part video tutorial from a few years ago:
https://www.youtube.com/watch?v=hImu83hoRL0

It is basically the kind of thing that I’m looking for, but I’m not 100% sure that it’ll actually work in my case. So, I’m just asking if there is an easier way to do this. (Even if it’s a plugin on the marketplace)

Any help would be greatly appreciated!

From what I’ve read on the forum data tables are readonly and can’t be saved at runtime.
You could go for a sqlite implementation in place of datatables, that should allow for modifications.
You could then populate the structs from the sqlite entry.

or freesqllite from the marketplace, though it might be tough to upgrade to newer versions of the engine (not sure if source is included)

Updated target files for SQLiteGameDb to work with 5.4
TutorialDemoEditor.Target.cs (498 Bytes)
TutorialDemo.Target.cs (496 Bytes)

Instead of using data tables you could just call the info from an excel sheet directly (plugin) and save over it directly both at runtime.

I’ve thought about using a database and just doing that instead, but I really would prefer to have this be an (at least mostly) offline application. So, having the data be imported during runtime from a database would be less than ideal. I wouldn’t mind it if I had to use a database once to transfer the data into my project, but using SQLite or similar solutions means that I’d be stuck with an online only system.

As for Excel or Google spreadsheets, I’ve thought about that too. And I think that’s probably going to have to be the way to go, because I know there’s a plugin that allows the user to import CSV/Google Sheets/Excel files into unreal engine as data tables. So I could call the API, get the data, update the spreadsheet, then once it’s all done, import that as a data table.

It just seems so complicated for something that I feel should be naturally supported by the engine. If anyone else has any other suggestions or better solutions, I’m still very interested in hearing them. Thank you for your help!

Sqllite is a local self contained file based database. It can handle persistancy.
I would stay away from Google as any type of middleman. They will not keep their services free and with time you will be at their mercy witj either them changing the underlying tech or having you pay a monthly fee for heavier data usage.

Better to just get a proper database for storing stuff online if your need external persistence mariadb or mysql are enough with a small php or python backend for db interaction.

I apologize, I don’t think I explained myself well in the last post. From my understanding, using a database system like SQLite or similar is an online only thing like requesting data from a server. And I wasn’t saying that I wanted to STORE the data on Google sheets, I just wanted to use it to import it into Unreal. Like, call the API, get the data, pass it into a spreadsheet, as soon as all the data has been gathered at runtime and sent to the spreadsheet, use a plugin to immediately import that spreadsheet as a data table into the unreal engine as an asset that I can reference later. Not to keep the data on the spreadsheet to continue referencing, because that would still be an online only solution. I need all this data to be stored and packaged with the application so it can 100% run offline. (That’s the goal) If I absolutely need to, having a database system would be probably my option if I can’t find a way to import the data directly into the engine.

Then the Sqlite option would work. It’s a database but it is local only. Think of it like a datatable where you can modify the variables and save / load them. It can also have starting values so it won’t start off empty.
If you do want to update them later on externally then you would need to either give your users a way to change it (if you want them to even have access to this info) or an online source of information probably handled through a rest api, that would update the db probably through parsing json.

As for updating the editor only values then what is stopping you from using the method mentioned in the youtube video?

You could also use the editor utility widget if you are only doing this from the editor. It has nodes that can update assets, but will not be suitable for non-editor work (Editor nodes are cut out during the packing phase).

Oh okay, nice! I was under the mistaken impression SQLite was online only. That makes things nicer if it’s all offline. I may take another look into it then.

As for the YouTube video I initially linked too, it may indeed work for what I need, but I just didn’t know if that method could be extended to custom structures and data tables, and I’m not the best with C++ unfortunately. So it may have taken quite a while for me to be able to get it working properly if at all.

However, that last suggestion seems like it actually might be exactly what I’m looking for! I didn’t know about Editor Utility Blueprints/Widgets. I just watched the Unreal GDC panel about it, and it appears that I could do all the logic I want to in a ln Editor Utility Blueprint! I’ll have to test it later today to see if it will actually let me do what I want, but it sounds very promising! If not, then I’ll probably take another look at a local database solution as you suggested. After I test it, I’ll come back to update you on if it works. Thank you so much for all your help, seriously!

1 Like

@Meganaught
Found an option to change assets via python. Might interest you. This effects bp in content browser.

My earlier post in the thread can effect actors in a level.

Okay, sorry about the long delay in posting here. So the Editor Utility Blueprints that you mentioned are actually a great system, and they are working out perfectly after some testing. Now, I am having to use a plugin to actually get the data to populate into a data table because Epic’s native support for editing data tables is absolutely lacking.

This is the plugin I’m using:
https://www.unrealengine.com/marketplace/en-US/product/data-table-function-library

But I got it working, and it’s very very nice. For anyone else who tries this, if you are adding any significant number of rows or data to a Data Table, make sure you don’t have it opened up in a tab because that will REALLY slow down the process or just lock up the editor, so make sure the asset is closed in the editor while you’re editing data.

Thank you so much @3dRaven, you have seriously helped me out here.

For others looking to manipulate editor assets (Not just Data Tables), here is the intro to Editor Utilities that helped me out significantly:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.