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

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
nicmar
Posts: 133
Joined: Wed Aug 21, 2019 2:39 am

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

Post 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! :)
Working on SpaceChef - A wacky open world space western, featuring a chef with nothing to loose, after he loses everything.. ;) Follow our work on @BlueGooGames.
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

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

Post 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--; }
Post Reply