Page 1 of 1
Same conversation keeps repeating
Posted: Tue Dec 31, 2024 12:02 am
by aandinofreeland
I've been trying to make a database at runtime following the guide I've seen posted as well as reading the documentation. I get everything to work fine. The first conversation prints as expected, but each time I try to print a new one after that it just replays the same conversation as the first one. I made sure this wasn't anything on my end as all my debug logs for the dynamic dialogue are showing the correct text to print, but the dialogue shown through the DialogueSystem doesn't match.
Re: Same conversation keeps repeating
Posted: Tue Dec 31, 2024 3:25 am
by aandinofreeland
I have discovered using
DialogueManager.ResetDatabase(DatabaseResetOptions.RevertToDefault);
did the trick, but it resets all my variable values which becomes an issue.
Re: Same conversation keeps repeating
Posted: Tue Dec 31, 2024 7:26 am
by Tony Li
Hi,
When you're done with a conversation, I recommend removing and destroying its database to free up the memory it's using:
Code: Select all
DialogueManager.RemoveDatabase(runtimeDatabase);
Destroy(runtimeDatabase);
Alternatively, you could create and reuse a single "fake" conversation whose details you fill in at runtime. (This is what the Dialogue System's Ink integration does. It lets Ink run the back-end engine, and the Dialogue System just acts as a front-end to serve up whatever text and choices Ink produces.)
To fill in the details at runtime, you can use an OnConversationLine() method to set the fake dialogue entry's subtitle text. Example:
Code: Select all
const int FakeConversationID = 9999;
...
var conversation = template.CreateConversation(FakeConversationID, "Fake Conversation");
// (Create a START node and a node with entry ID 1 linked from START.)
...
void OnConversationLine(Subtitle subtitle)
{
if (subtitle.dialogueEntry.conversationID == FakeConversationID && subtitle.dialogueEntry.id == 1)
{
subtitle.formattedText.text = /* get text from some other source */
}
}