Page 1 of 1
How to create and assign a custom dynamic Database at Runtime?
Posted: Tue Jun 03, 2025 12:33 pm
by Skermunkel
Hi everyone,
I'm trying to figure out how to go about creating a Database from scratch during Runtime using a Custom Database Class Script that I created with all of my Character and Context Data (Character Names, Knowledge Goals) that the Dialogue Editor can read from and then create the set amount of Characters, Quests, Items etc. and then assign that Custom Database to my DialogueManager/Actors during Runtime as well.
I essentially want to create a template Database Class that the Dialogue System can create a Dynamic Database from during Runtime and then assign it to the Diologue Manager for my Scene as well as assign it to all of the Actors in the scene.
If the forum needs any other info from me, please let me know.
Any help on the matter would be greatly appreciated

Re: How to create and assign a custom dynamic Database at Runtime?
Posted: Tue Jun 03, 2025 1:35 pm
by Skermunkel
A super extra bonus would be if it is possible to do this with a Multi-Database structure as well as using a combination of pre-defined databases (for static Actors, Variables etc.) and Generated Databases (splitting up the Dynamic Custom Class Database(s) generated at Runtime).
Re: How to create and assign a custom dynamic Database at Runtime?
Posted: Tue Jun 03, 2025 3:10 pm
by Tony Li
Hi,
Yes, you can do that. The steps are similar to:
How To: Create Dialogue Database At Runtime
For example, say your script has a data structure like this:
Code: Select all
public class CharacterRoster
{
public List<CharacterData> characters;
}
public class CharacterData
{
public string name;
public string description;
public string knowledge;
public string goals;
}
Assume you've created a static dialogue database in the Dialogue Editor window, and its Base ID is 0.
You can create a runtime database with a Base ID of 10000 to ensure that its internal ID numbers don't conflict with the static database. Some example code:
Code: Select all
// Create database:
var database = ScriptableObject.CreateInstance<DialogueDatabase>();
// Set base ID that's unlikely to conflict with already-loaded databases:
database.baseID = 10000;
// Create a template, which provides helper methods for creating database content:
var template = Template.FromDefault();
// Create actors:
foreach (CharacterData characterData in characterRoster.characters)
{
int actorID = template.GetNextActorID(database);
Actor actor = template.CreateActor(actorID, characterData.name, isPlayer: false);
actor.Description = characterData.description;
actor.fields.Add(new Field("Knowledge", characterData.knowledge);
actor.fields.Add(new Field("Goals", characterData.goals);
}
// Add it to the runtime environment:
DialogueManager.AddDatabase(database);
If you intend to forget this database when leaving the current scene, make sure to remove it from the Dialogue System's runtime environment and destroy it:
Code: Select all
DialogueManager.RemoveDatabase(database);
Destroy(database);
Re: How to create and assign a custom dynamic Database at Runtime?
Posted: Tue Jun 03, 2025 5:02 pm
by Skermunkel
Wow! Thanks again so much for the prompt response and amazing breakdown Tony, I truly appreciate it!
Just one other question I have on the topic:
How do I go about going to integrate this structure with the other External Database Integration packages, specifically Love/Hate, Quest Machine, Inventory Engine and RPG Builder. I am using the Integration packages for all 4 of these projects together (along with their integrations with Dialogue System) to integrate and interconnect them all with each other. I just wanted to check if there is a way to keep my Custom Dynamic Runtime Database also in connection and consistent with the interconnected Integration systems of these plugins?
Re: How to create and assign a custom dynamic Database at Runtime?
Posted: Tue Jun 03, 2025 7:09 pm
by Tony Li
I don't think your custom runtime database will step on the feet of any of those other integrations. You can go ahead and use them as designed.