Runtime database not showing choices
Posted: Fri May 23, 2025 9:53 am
I'm planning on having dynamic choices that will redirect to other dialogues (each choice will be an NPC in a location that the player can interact with). I've created a runtime database with dialogue entries with the player as the actor, but when I execute the function, the dialogue only shows the last dialogue entry as normal text, not as a choice.
When I try to play the runtime dialogue in the master dialogue view, only the first choice is shown, but as a choice and not as a normal text (the first dialogue entry is blue and the second is gray).And then, when I click on the second dialogue entry in the editor (it changes from gray to blue) and try to play the dialogue again, both choices are displayed.
After clicking in the second dialogue entry
When I try to play the runtime dialogue in the master dialogue view, only the first choice is shown, but as a choice and not as a normal text (the first dialogue entry is blue and the second is gray).And then, when I click on the second dialogue entry in the editor (it changes from gray to blue) and try to play the dialogue again, both choices are displayed.
After clicking in the second dialogue entry
Code: Select all
public void GenerateActorSelection()
{
var database = ScriptableObject.CreateInstance<DialogueDatabase>();
var template = Template.FromDefault();
// Create conversation
//int conversationId = template.GetNextConversationID(database);
int conversationId = 1000;
var conversationTitle = "Choices";
var conversation = template.CreateConversation(conversationId, conversationTitle);
conversation.ActorID = 1;
database.conversations.Add(conversation);
// START node
var startNode = template.CreateDialogueEntry(0, conversation.id, "START");
startNode.Sequence = "None()";
conversation.dialogueEntries.Add(startNode);
// Dialogue nodes
var choice1 = template.CreateDialogueEntry(1, conversation.id, string.Empty);
choice1.ActorID = 1;
conversation.ConversantID = 1;
choice1.DialogueText = "Choice 1";
conversation.dialogueEntries.Add(choice1);
// Dialogue nodes
var choice2 = template.CreateDialogueEntry(2, conversation.id, string.Empty);
choice1.ActorID = 1;
conversation.ConversantID = 1;
choice2.DialogueText = "Choice 2";
conversation.dialogueEntries.Add(choice2);
// Link from START to Choice 1
var link = new Link(conversation.id, startNode.id, conversation.id, choice1.id);
startNode.outgoingLinks.Add(link);
// Link from START to Choice 2
var link2 = new Link(conversation.id, startNode.id, conversation.id, choice2.id);
startNode.outgoingLinks.Add(link2);
DialogueManager.AddDatabase(database);
DialogueManager.StartConversation("Choices");
}