Page 1 of 1
Event when responses are shown
Posted: Mon Feb 23, 2015 3:35 am
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 !
Event when responses are shown
Posted: Mon Feb 23, 2015 3:58 am
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.