Immediate Save nodes lock the game until the file on disk is updated.

The two videos above, Nilson Lima shows how to use the multi-threaded async system to save database on background.

The other video above, on part 2, author shows what he does to pick a database per level and another for player stats.
He just compares db name to level name, while naming level and db the same name.

Thank you for the answer! There were tons of replies here but I guess they dissappeared with the forum update. Such a shame.

Do you have any suggestion for saving spawned actors? For example, when I build a house, I want to save it’s existance. If it’s not directly covered with the plugin (which is what I expect), I can easily find workarounds.

Just curious if there is an in-plugin solution for that.

best way to convert datatables to use sqlite? ie, i want to move all my possible in game items to be in the DB

For spawned actors, you need to control IDs of instances stored in db files.
I would not let Unreal use auto generated actor names for spawned houses, I would instead create custom IDs to store them in a db row.

You can either use the “Make DB” functions to create a storage ID for a house blueprint, or directly store your own into a string property (of type Name) called "DBID ".


I prefere to use the DBID directly from Unreal Editor instead of using the “Make DBID” function:

When the blueprint is spawned, it will be registered with the ID default value:

1 Like

I would convert them to structs that can be stored in Player State or Character blueprints.
Mark them with ‘Save Game’ and then add to the DB a column of same type to record them (STRUCT column type).

The struct should not contain object reference types if the parent container is a struct.
Object references I would store directly into the Character blueprint, and store as a separate OBJECT column into the DB.

thanks, if i have an inventory component that saves its data, how would you associate that to a player controller?

the inventory component would have its ID as the key, would you then have a table that associates the player controller to the inventory?

Sorry, I did not understand your question.
You can record to db a component the same way you record actors.

If you don’t want to turn the component class into a blueprint, you can assign its DBID value from within the component’s parent actor construction script.

Thank you for your detailed answer! I’m going to try that and come back with the results. My target is saving different players’ inventories. I guess I know how to do that thanks to your post.

is there a way to see why a save was not succcessful? I see the sql statement populated, in the gamemode, on save finished, i get false.

You will have to turn on logs on plug-in settings and check output log panel to see reports.

Either on project settings panel or db asset there should be a checkbox to enable logging.

ah, ok thanks. nothing major, all i see is this:

USQLog: Error: {USQL}:: unrecognized token: "1_GameFiles"

ok was due to some values in one of my structs, either the class ref or the texture2d

"thumbnail_10_7F85988143D20C7A77B2578E0F001055": "Texture2D'/Game/1_GameFiles/Inventory/Icons/ICON_Assault_Rifle.ICON_Assault_Rifle'",
                        "maxStackSize_12_CB720F62436B858D4F003FABC12C2206": 1,
                        "isConsumable_14_39DE06354EB58E4E9A64FE9E2500F7ED": false,
                        "durability_17_CD678BB34240ABB94D728B97D2534865": 1,
                        "class_21_BEE1C52B4293D7687CE9EC8D5DCF2999": "BlueprintGeneratedClass'/Game/1_GameFiles/Inventory/Items/Weapons/AssaultRifle.KOB_AssaultRifle_C'",

is this the case where should not store those objects in the struct?

I would try to use soft references instead.
If there’s complaints about object reference in structures being saved…

Hey Bruno, I tried your tutorial and everything works perfectly. Thank you again! I can save my inventory and load it as long as the id matches. I will use the same approach for spawned actors. DBID variable helps a lot.

I have question about save game slots.

Is it possible to have save game slots with this plugin? For example, in Minecraft when you create a world, it creates a new folder and your world data, inventory information etc. stored in that folder. Maybe something like that. I have a plan to have 3 save game slots for both multiplayer and singleplayer. I really like being able to save changes immediately with this plugin so being able to have slots would be amazing.

Also what do you think about having multiple databases? I noticed if I save different actor/component classes in the same database, I will have NULL values for missing variables as expected. For example my inventory and stats both have their own components. Would it be better to have “PlayerInventory database & PlayerStats database” or something covers both of them? I guess it’s not a big deal but I would love to hear your opinion about that.

the soft references for the classes fixed the saving for me. running into some multi server issues at the moment. currently the inv actor component is attached to the player controller, the server PC seems to get loaded, but the client one doesnt seem to load the saved inv.

@Emrehan I think multiple Dbs is good organization. The only thing I wouldn’t do is create multiple DBs for multiple systems * levels (one db for each level for each system), that would be chaotic.

It’s fine to have ‘NULL’ records around, but they could indicate better system design could be in place.

And about Slots, I think table ‘Versions’ can be used as slots, but you would have to wait for me to expose them to blueprints, so you could set active table to use at runtime as active slot. Currently you can’t set a target table at runtime from blueprint code.

When you add new table versionings and hit “DROP & REBUILD”, you can set on Db the target version to use, but in editor only. I will see how I can expose it to blueprint:

1 Like

@phishdisc the Db is authoritative.
This means, you have to replicate your Properties or pass them to the Client side with a RPC after values are loaded from Db by the server.

Client software cannot “see” the Db API of functions in C++ land.

Makes sense, I will keep your suggestions in mind!

Sounds great! I’m not in hurry, but hearing that there is going to be a solution for multiple slots is relieving. Then I can use this plugin as a save system for my game.

Thanks for taking your time. :slight_smile:

I think this is easy enough to use, after you create versioned tables like screenshots above (I am also fixing Details Panel refresh bug that happens when version list is changed).

Does this make sense to you?

thanks, i was able to create a test simple program and get the inv component to save/load properly (dbid def helped)

question though, when i am running one player in standalone, and i tell the game mode to save, i see it doing 3 insert/replace in the logs, is this expected?

USQLog: {USQL}:: INSERT OR REPLACE INTO DB_Inventory (ID,Inventory) VALUES ('testingdbid','UArray>>{ ...
USQLog: {USQL}:: INSERT OR REPLACE INTO DB_Inventory (ID,Inventory) VALUES ('testingdbid','UArray>>{ ...
USQLog: {USQL}:: INSERT OR REPLACE INTO DB_Inventory (ID,Inventory) VALUES ('testingdbid','UArray>>{ ...