Hi, I'm having a "nullreference exception" error while setting a database inside my script.
The database is correctly referenced and I use the "dialogueSystemController.AddDatabase()" method to set it.
Is this the proper way of doing this?
Thanks in advance.
Setting Database By Code
Re: Setting Database By Code
Hi,
Can you use DialogueManager.AddDatabase(DialogueDatabase)?
For example, say you have a dialogue database asset named DB1 in a Resources folder. You can load it into the Dialogue System like this:
There are some other examples on this forum of converting articy:draft and Chat Mapper files at runtime into databases and then adding them, as well as creating a database from scratch in code using the Template class. (To use the Template class, create an instance by calling Template.FromDefault(). Then use the Template methods such as CreateConversation to create a new conversation that you can add to the database.)
If you're still getting an error, would you please click on the error message in the Console window, press Ctrl+C to copy it to the clipboard, and then paste it into a reply? This will include the full stack trace that should help identify the issue.
Can you use DialogueManager.AddDatabase(DialogueDatabase)?
For example, say you have a dialogue database asset named DB1 in a Resources folder. You can load it into the Dialogue System like this:
Code: Select all
using PixelCrushers.DialogueSystem;
...
var database = Resources.Load("DB1") as DialogueDatabase;
if (database != null) DialogueManager.AddDatabase(database);
If you're still getting an error, would you please click on the error message in the Console window, press Ctrl+C to copy it to the clipboard, and then paste it into a reply? This will include the full stack trace that should help identify the issue.