I need to create conversations through editor script.
This conversation must have 2 entries (and 1 startnode)
I create the 2 entries and add them to conversation.
Everything works fine, except the start node that is created with an ID succesive to the previous 2 entries.
What's the correct procedure to create conversation with a startnode with id=0?
I've also tried creating the startnode myself setting id=0 and root=true but another startnode gets created automatically.
Code: Select all
Conversation conv = new Conversation();
//DialogueEntry de_start = new DialogueEntry();
//de_start.isRoot = true;
//de_start.id = 0;
//de_start.fields = new List<Field>();
//de_start.fields.Add(new Field("Title", string.Empty, FieldType.Text));
//de_start.fields.Add(new Field("Description", string.Empty, FieldType.Text));
//de_start.fields.Add(new Field("Actor", string.Empty, FieldType.Actor));
//de_start.fields.Add(new Field("Conversant", string.Empty, FieldType.Actor));
//de_start.fields.Add(new Field("Dialogue Text", string.Empty, FieldType.Text));
//de_start.Title = "Start";
DialogueEntry de_name = new DialogueEntry();
de_name.id = 1;
de_name.fields = new List<Field>();
de_name.fields.Add(new Field("Title", string.Empty, FieldType.Text));
de_name.fields.Add(new Field("Description", string.Empty, FieldType.Text));
de_name.fields.Add(new Field("Actor", string.Empty, FieldType.Actor));
de_name.fields.Add(new Field("Conversant", string.Empty, FieldType.Actor));
de_name.fields.Add(new Field("Dialogue Text", string.Empty, FieldType.Text));
DialogueEntry de_description = new DialogueEntry();
de_description.id = 2;
de_description.fields = new List<Field>();
de_description.fields.Add(new Field("Title", string.Empty, FieldType.Text));
de_description.fields.Add(new Field("Description", string.Empty, FieldType.Text));
de_description.fields.Add(new Field("Actor", string.Empty, FieldType.Actor));
de_description.fields.Add(new Field("Conversant", string.Empty, FieldType.Actor));
de_description.fields.Add(new Field("Dialogue Text", string.Empty, FieldType.Text));
conv.fields = new List<Field>();
conv.fields.Add(new Field("Title", string.Empty, FieldType.Text));
conv.fields.Add(new Field("Description", string.Empty, FieldType.Text));
conv.fields.Add(new Field("Actor", string.Empty, FieldType.Actor));
conv.fields.Add(new Field("Conversant", string.Empty, FieldType.Actor));
conv.fields.Add(new Field("Menu Text", string.Empty, FieldType.Text));
conv.fields.Add(new Field("Dialogue Text", string.Empty, FieldType.Text));
conv.Title = "MyTitle;
ds.initialDatabase.AddConversation(conv);
//conv.dialogueEntries.Add(de_start);
conv.dialogueEntries.Add(de_name);
conv.dialogueEntries.Add(de_description);
}
ds.ResetDatabase(DatabaseResetOptions.KeepAllLoaded);
EditorUtility.SetDirty(db);