Ink integration - Conversation not found in the database

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Humble
Posts: 2
Joined: Wed Mar 15, 2023 6:08 pm

Ink integration - Conversation not found in the database

Post by Humble »

Hi,

I'm a novice using Dialogue System for Unity with Ink integration. I've followed the setup documentation with third party integration and I did have everything working. I'm sorry in advance if this question has been asked before, I did search but didn't find anything relevant to my issue.

I have a simple project containing 2 scenes; Scene 1 is a main menu (no Dialogue Manager yet) and Scene 2 a tutorial scene which uses an instance of the Dialogue Manager with Ink integration running a small ink file in a custom UI. This dialogue is initiated `OnStart` via a Dialogue System Ink Trigger.

I was only developing Scene 2 initially and could run this in Unity with no issues.

The issue arose when I started Scene 1 and loaded Scene 2 via an OnClick event, again the dialogue was initiated and worked fine, but when returning to developing Scene 2 from another session, the Dialogue System no longer initialises the conversation. This persists after closing Unity and I can no longer run the conversation from Scene 2.

The Dialogue System is mostly using the default configuration, i.e. Allow Only One instance and Don't Destroy on Load are both enabled.

I have enabled debugging, and have noticed the attached warning and info logs.

I'm not sure why the conversation is not found in the database, then subsequently it is loaded and the conversation is created.

Hopefully you can help me understand where I'm going wrong!
Attachments
ink-warning.png
ink-warning.png (15.47 KiB) Viewed 152 times
User avatar
Tony Li
Posts: 21684
Joined: Thu Jul 18, 2013 1:27 pm

Re: Ink integration - Conversation not found in the database

Post by Tony Li »

Hi,

Please try this:
  • Add a Save System component to the Dialogue Manager GameObject if it doesn't already have one, and if no other GameObject in Scene 2 has a Save System component.
  • Set the Save System's Frames To Wait Before Apply Data to 1.
  • Set the Dialogue System Trigger's trigger dropdown to OnSaveDataApplied.
Here's a long-winded explanation:

When a Dialogue System Trigger is set to OnSaveDataApplied, it will perform its actions after save data has been applied (e.g., after loading a saved game or changing scenes using the save system) -- or, if not applying save data, then after Frames To Wait Before Apply Data.

The Ink integration loads your Ink stories into the Dialogue System in a Start() method, which runs right before the first frame of a scene.

When a Dialogue System Trigger is set to OnStart, it performs its actions at the end of the scene's first frame. Normally this means it will perform its actions after the Ink integration has loaded your Ink stories. However, several Unity versions (mostly 2020.x) have a bug that scrambles execution order in the first frame when entering editor play mode, causing methods that are waiting for the end of the frame to actually end up waiting 2 frames. For some designers, some Dialogue System Triggers absolutely must start on the first frame. To handle this, if it's the first frame of entering editor play mode, Dialogue System Triggers set to OnStart perform their actions immediately -- which means it might try to start the conversation before the Ink integration has loaded the stories.
Humble
Posts: 2
Joined: Wed Mar 15, 2023 6:08 pm

Re: Ink integration - Conversation not found in the database

Post by Humble »

Hi Tony,

Thank you very much for the quick response, your solution has solved my issue.

I really appreciate the background explanation. I have a better understanding of the problem and to be aware of it in the future.

Dialogue System for Unity is incredible and your support is unparalleled!
User avatar
Tony Li
Posts: 21684
Joined: Thu Jul 18, 2013 1:27 pm

Re: Ink integration - Conversation not found in the database

Post by Tony Li »

Thanks! Glad to help!
Post Reply