Event when responses are shown

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
NicoMou
Posts: 1
Joined: Mon Feb 23, 2015 8:02 am

Event when responses are shown

Post by NicoMou »

Hello !



Is there a way to detect when responses are shown on screen ? I need to display something when the response panel is appearing.



OnConversationLine is not fired for responses and I have not seen something like a OnResponse. Do I have to use OnContinue ?



Thanks !
User avatar
Tony Li
Posts: 22112
Joined: Thu Jul 18, 2013 1:27 pm

Event when responses are shown

Post by Tony Li »

Hi,



No message like OnConversationLine is sent when the responses are shown. Here are two ways to detect when responses are shown:



1. When the dialogue UI shows responses, it activates the Response Panel GameObject. You can add a script that implements OnEnable:

void OnEnable() {

if (PixelCrushers.DialogueSystem.DialogueManager.IsConversationActive) {

// (response menu shown; show your "something")

}

}

By the way, if your "something" is a child of Response Panel, it will be automatically shown when Response Panel is activated.







2. Alternate method: Create a subclass of your dialogue UI class (e.g., a subclass of UnityDialogueUI). Override the ShowResponses method:

using PixelCrushers.DialogueSystem;



public class MyDialogueUI : UnityDialogueUI {



public override void ShowResponses(Subtitle subtitle, Response[] responses, float timeout) {

base.ShowResponses(subtitle, responses, timeout);

// (show your "something" here)

}

}

Then just inspect your dialogue UI and drag this into the Script slot.


Post Reply