Page 1 of 1

How can I detect is anyone is speaking or barking at the moment?

Posted: Thu Aug 29, 2019 10:45 am
by nicmar
Is there a way to check if there is any conversation and/or bark going on at the moment?

I have a UI that i'd like to hide during conversations.

I know I can listen to some things like OnConversationStart, but if multiple would happen at the same time, and/or a Bark, it might be hard to know what starts and what ends.

Thanks! :)

Re: How can I detect is anyone is speaking or barking at the moment?

Posted: Thu Aug 29, 2019 2:00 pm
by Tony Li
If you're only concerned about conversations, you can check the Boolean property DialogueManager.isConversationActive.

Most devs use Dialogue System Events to hide/disable other things (such as gameplay UIs) during conversations. Configure OnConversationStart() to disable the gameplay UI's Canvas, and use OnConversationEnd() to re-enable it.

If you also need to know about barks, add a script to the Dialogue Manager with OnBarkStart() and OnBarkEnd() methods that keep track of the number of active barks:

Code: Select all

int numActiveBarks = 0;
public isBarkActive { get { return (numActiveBarks > 0); } }
void OnBarkStart(Transform barker) { numActiveBarks++; }
void OnBarkEnd(Transform barker) { numActiveBarks--; }