SQLite in Unreal Engine 4

How can I interact with my own SQLite databases in Unreal Engine 4? Can this be done with drawing and C ++ or should it be purely C ++?

+3


source to share


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();
      

Run codeHide result


+2


source


I used the VaRest plugin (available blueprints) which passed my server to process the records into the database, this route might be easier.



https://wiki.unrealengine.com/VaRest_Plugin

-1


source







All Articles