I had defined this databasearray variable in the scope of my class:
- Code: Select all
DatabaseArray LibraryIndexArray = new DatabaseArray();
I then used BigDB to load the values from the databaseobject so that the player could see what was in their library:
- Code: Select all
LibraryIndexArray = result.GetArray("LibraryIndex");
Then, LibraryIndexArray was modified according to which cards the player wanted to add or remove.
After that, when the player was ready to save the final changes to their library, this code executed inside a BigDB load statement:
- Code: Select all
result.Set("LibraryIndex", LibraryIndexArray); // ERROR HERE
The error generated was:
Cannot create circular references inside database objects
I had no idea why it was claiming to be a circular reference, but I had a feeling that if I just created a new databasearray variable and loaded the values into that new object, it would save successfully. And it did.
- Code: Select all
DatabaseArray NewLibraryIndexArray = new DatabaseArray();
for (i = 1; i <= LibraryIndexArray.Count; i++) {
NewLibraryIndexArray.Add(LibraryIndexArray.GetUInt(i - 1));
}
result.Set("LibraryIndex", NewLibraryIndexArray); // No Error Thrown
I tested the save function afterwards, and it correctly saved the changes to LibraryIndexArray.
So if anyone has this error show up again, here is your solution.