Change database at runtime
Posted: Thu Sep 17, 2020 9:47 am
[Unity 2019.4.10f - DS v2.2.10]
Hi Tony!
For testing purposes I'm currently creating a database at runtime from an Articy XML exported file, but I'm not sure how to entirely swap it with the one that was there first in the Dialogue System Controller.
In other words I don't want to add an extra database, I want to entirely switch the previous one with the new imported one. Is this currently possible?
Through code I can swap the defaultDatabase and the initialDatabase into the new one but the masterDatabase, which is - if I'm not wrong - the one that is called by DialogueSystemController.StartConversation(), is read-only and I'm not sure which are the methods to override it (if there are any).
I also tried creating a new DatabaseManager from the one I imported and overwrite the one in the Dialogue System Controller
but databaseManager is also read-only.
I'm trying to read both the code and the documentation but I admit a bit of confusion when it comes to figuring out initialDatabase, defaultDatabase and masterDatabase and what's their respective purpose.
Reading this thread I kind of understand the point
It makes me think that I need to .RemoveDatabase()/.AddDatabase() the masterDatabase, so that the system handles the whole process correctly, but I'm not entirely sure how to proceed.
Do you have any suggestions?
Thanks a lot as always, in the meantime!
Hi Tony!
For testing purposes I'm currently creating a database at runtime from an Articy XML exported file, but I'm not sure how to entirely swap it with the one that was there first in the Dialogue System Controller.
In other words I don't want to add an extra database, I want to entirely switch the previous one with the new imported one. Is this currently possible?
Through code I can swap the defaultDatabase and the initialDatabase into the new one but the masterDatabase, which is - if I'm not wrong - the one that is called by DialogueSystemController.StartConversation(), is read-only and I'm not sure which are the methods to override it (if there are any).
I also tried creating a new DatabaseManager from the one I imported and overwrite the one in the Dialogue System Controller
Code: Select all
dialogueSystemController.databaseManager = new DatabaseManager(importedDatabase);
I'm trying to read both the code and the documentation but I admit a bit of confusion when it comes to figuring out initialDatabase, defaultDatabase and masterDatabase and what's their respective purpose.
Reading this thread I kind of understand the point
but, again, I'm not sure how to "overwrite" the previous one with the one I have imported.Tony Li wrote: ↑Sat May 20, 2017 2:42 pm At runtime, the Dialogue System maintains a "master database" in memory. When you add a database at runtime, the Dialogue System fills in the master database with any assets (e.g., actors, variables, conversation, etc.) that aren't already in the master database. When you delete a database at runtime, the Dialogue System removes any assets (e.g., conversations) that aren't also defined in other added databases such as the global database.
It makes me think that I need to .RemoveDatabase()/.AddDatabase() the masterDatabase, so that the system handles the whole process correctly, but I'm not entirely sure how to proceed.
Do you have any suggestions?
Thanks a lot as always, in the meantime!