Is there a way, for example, to detect if the Dialogue Window is currently open and active?
Like if I wanted to prevent things from happening in the game if the dialogue window is open, how might I do that?
I feel like I saw some sort of DialogueSystem.dialogueWindowIsOpen or something somewhere, but I can't find it now.
Universal Dialogue State
Re: Universal Dialogue State
Wait, wait, I think I found it: DialogueManager.isConversationActive
Is this the best way to do this?
Is this the best way to do this?
Re: Universal Dialogue State
Hi,
Yes, that's a way to check if you only need to check once -- such as if the player has pressed a button to open a menu or perform some action.
If you need to check every frame, there's an alternative. You can register methods with the C# events DialogueManager.instance.conversationStarted and conversationEnded, or add a script with OnConversationStart and OnConversationEnd special methods to the Dialogue Manager.
Yes, that's a way to check if you only need to check once -- such as if the player has pressed a button to open a menu or perform some action.
If you need to check every frame, there's an alternative. You can register methods with the C# events DialogueManager.instance.conversationStarted and conversationEnded, or add a script with OnConversationStart and OnConversationEnd special methods to the Dialogue Manager.
Re: Universal Dialogue State
Oh wow, can I use those like this?
Code: Select all
OnEnable()
{
DialogueManager.instance.conversationStarted += DoThing;
}
Re: Universal Dialogue State
Yes, absolutely. A common setup is:
On the other hand, if you only want to do something once for a single conversation, you can do this:
Code: Select all
void OnEnable()
{
DialogueManager.instance.conversationStarted += DoThing;
}
void OnDisable()
{
DialogueManager.instance.conversationStarted -= DoThing;
}
On the other hand, if you only want to do something once for a single conversation, you can do this:
Code: Select all
void OnEnable()
{
DialogueManager.instance.conversationStarted += DoThing;
}
void DoThing(Transform actor)
{
DialogueManager.instance.conversationStarted -= DoThing;
// Do the thing here....
}
Re: Universal Dialogue State
Perrrfect, thank you!
Re: Universal Dialogue State
Happy to help!