SQLite in Unreal Engine 4
2 answers
SQLite can be accessed from the Unreal Engine either from a drawing (I haven't done that yet) but, check out the TappyChicken example schema, the SaveGame class can store / load many variables via any event you want. There is also a nice YouTube video here:
http://www.youtube.com/watch?v=v0WRumU-gOk
As for the code, I am using https://github.com/afuzzyllama/DataAccess . Try it. It can save UObjects to local sqlite database.
For example:
TSharedPtr<SqliteDataResource> DataResource = MakeShareable(new SqliteDataResource(FString(FPaths::GameDir() + "/Data/Test.db")));
DataResource->Acquire();
TSharedPtr<IDataHandler> DataHandler = MakeShareable(new SqliteDataHandler(DataResource));
UTestObject* TestObj = NewObject<UTestObject>();
// Create a record
DataHandler->Create(TestObj);
// Read a record
DatHandler->Read(/**record id*/ 1, TestObj);
// Update a record
TestObj->SomeProperty = "some value";
DataHandler->Update(TestObj);
// Delete a record
DataHandler->Delete(TestObj);
// This shouldn't be necessary since this should be run when the TSharedPtr runs out of references
DataResource->Release();
+2
source to share