DialogueManager.PlaySequence() not triggering OnSequenceStart \ OnSequenceEnd events?
Posted: Tue Oct 20, 2020 4:56 am
[Unity 2019.4.12f1 - DS v2.2.11]
Hi Tony!
I'm still playing around with the different events in order to create a chain of sequences. In other words I want to:
Attempting to do so, I noticed that the OnSequenceStart \ OnSequenceEnd events seem to only be triggered when Sequences get called from within a Conversation. If in a custom C# script I include either DialogueManager.PlaySequence() or DialogueManager.instance.PlaySequence(), the referenced sequences would run, but I don't get any event back.
FWIW, I have ticked the Inform Sequence Start And End tickbox in the Dialogue Manager and also attached to it a custom "event broadcaster" script that for each of the events invokes a custom event.
The above code works, meaning that I am able to have methods subscribe to each of these events (that's how I found out the OnSequenceStart \ OnSequenceEnd seem not to trigger outside of Conversations). I was also wondering if there was a way to pass the Sequence as a string, rather than the Actor's Transform.
Am I missing something?
Thanks a lot in advance, as always!
Hi Tony!
I'm still playing around with the different events in order to create a chain of sequences. In other words I want to:
- Run a sequence
- Wait for it to finish
Attempting to do so, I noticed that the OnSequenceStart \ OnSequenceEnd events seem to only be triggered when Sequences get called from within a Conversation. If in a custom C# script I include either DialogueManager.PlaySequence() or DialogueManager.instance.PlaySequence(), the referenced sequences would run, but I don't get any event back.
FWIW, I have ticked the Inform Sequence Start And End tickbox in the Dialogue Manager and also attached to it a custom "event broadcaster" script that for each of the events invokes a custom event.
Code: Select all
using UnityEngine;
using PixelCrushers.DialogueSystem;
public class DialogueSystemEventBroadcaster : MonoBehaviour
{
public delegate void Delegate_OnConversationStart(Transform actor);
public static event Delegate_OnConversationStart onConversationStart;
public delegate void Delegate_OnConversationEnd(Transform actor);
public static event Delegate_OnConversationEnd onConversationEnd;
public delegate void Delegate_OnSequenceStart(Transform actor);
public static event Delegate_OnSequenceStart onSequenceStart;
public delegate void Delegate_OnSequenceEnd(Transform actor);
public static event Delegate_OnSequenceEnd onSequenceEnd;
public void OnConversationStart(Transform actor) => onConversationStart?.Invoke(actor);
public void OnConversationEnd(Transform actor) => onConversationEnd?.Invoke(actor);
public void OnSequenceStart(Transform actor) => onSequenceStart?.Invoke(actor);
public void OnSequenceEnd(Transform actor) => onSequenceEnd?.Invoke(actor);
}
Am I missing something?
Thanks a lot in advance, as always!