I'd like to load an Ink story JSON string from an external source at runtime, give it a title, and then be able to trigger that conversation later by title, and get/set some of its variables from C# code. You know, kind of a modular streaming assets thing. I intend to load several stories this way, once I get it to do one successfully.
I'm loading the JSON string and giving it a title via the DialogueSystemInkIntegration instance's AddStory(title, json) function which appears to load it into the integration code's runtime-auto-created Ink database just fine. I see it in that specific database when I set a breakpoint in AddStoryToDatabase.
There is an issue though. It's unable to find the story later on when I call DialogueManager.StartConversation with that title. It doesn't appear that auto-created Ink database is "in" the database that ConversationModel is looking at, as supplied by StartConversation.
If I first issue a DialogueController instance databaseManager.Reset(DatabaseResetOptions.KeepAllLoaded) the fake conversation is then populated into the master database, but this seems like it would clobber other state information.
It also appears inkJSONAssets must contain the story in the DialogueSystemInkIntegration LookupStory function, which does not happen when you call AddStory. This means LookupStory returns null for the story I loaded with AddStory, which is still in the Ink database. This means I can't look up the story and get/set its variables. I don't see another way to get the added story when I call AddStory.
Are these bugs, or should I be doing it differently, and if so how would you recommend proceeding?
Loading Ink dialogue at runtime
Re: Loading Ink dialogue at runtime
Hi,
That was indeed a bug. You can download the updated integration package from the Dialogue System Extras page.
(direct download)
That was indeed a bug. You can download the updated integration package from the Dialogue System Extras page.
(direct download)
Re: Loading Ink dialogue at runtime
Hey, sorry for the late follow-up -- you fixed it perfectly. Thanks!
Re: Loading Ink dialogue at runtime
Glad to help!