Fixing the Wait Continue Phase Bug in Dialoguer

I’ve been working with a plug-in from the Asset Store created by Tony Coculuzzi (@

Dialoguer_1

 

Dialoguer_2But there’s a problem with it… The tool allows the game to pause for either seconds or frames before continuing onto the next dialogue. However, there is also an option that would allow the developer to call for the Dialogue tree to continue manually should they need to pause the dialogue after an event (perhaps to play a cut-scene or wait for input from the player for a tutorial or something) before continuing.

Unfortunately though, it’s broken. I understand that Tony is busy working on Cuphead, which is why there probably hasn’t been a fix, or perhaps it’s just been overlooked but either way, I needed to solve this problem for the current project we’re working on and knowing that it’s a tool other developers might be using, or should Tony end up seeing this. I figure it might be worth sharing the fix/solution/workaround.

Dialoguer_3

 

The Solution

In order to get the Continue wait feature working properly, it only takes a few simple code additions / changes to force the WaitPhaseComponent to process a Wait For Continue Call.

I’ve altered the original base script slightly before implementing this fix, so it’s possible I’ve removed something already but I’ll copy each function as it stands in my code for reference and so you should be able to match up these functions to get the fix working.

In WaitPhaseComponent.cs

Add a Singleton Reference called current beneath the class instance.

public class WaitPhaseComponent : MonoBehaviour {

 public static WaitPhaseComponent current;

 public DialogueEditorWaitTypes type;

On the Init() call, assign the Singleton to the instance of the WaitPhaseComponent.

public void Init(WaitPhase phase, DialogueEditorWaitTypes type, float duration){
 this.phase = phase;
 this.type = type;
 this.duration = duration;
 elapsed = 0;
 go = true;

current = this;
 }

 

In WaitPhase.cs:

Replace the Continue() function with the new singleton reference and make sure that the WaitPhaseComponent gets added if the type = DialogueEditorWaitType.Continue by commenting out the return call.

protected override void onStart (){

DialoguerEventManager.dispatchOnWaitStart();
 //if(type == DialogueEditorWaitTypes.Continue) return;
 GameObject gameObject = new GameObject("Dialoguer WaitPhaseTimer");
 WaitPhaseComponent waitPhaseComponent = gameObject.AddComponent<WaitPhaseComponent>();
 waitPhaseComponent.Init(this, type, duration);

}

public void waitComplete(){

DialoguerEventManager.dispatchOnWaitComplete();
 state = PhaseState.Complete;

}

public override void Continue(int outId)
 {

WaitPhaseComponent.current.Continue();
 /*
 if (type != DialogueEditorWaitTypes.Continue) return;
 DialoguerEventManager.dispatchOnWaitComplete();
 base.Continue (outId);*/
 }

 

Dialoguer_0This should now mean that when your game pauses to wait. Once the Dialoguer event is set to wait for continue, you will see the component in the Unity Editor and upon calling Dialoguer.WaitComplete() the dialogue branch will continue as it is supposed to.

Matt

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.