set bark duration from code

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
joeylu
Posts: 111
Joined: Sun May 17, 2020 1:07 pm

set bark duration from code

Post by joeylu »

Hi Tony,
I'm trying to achieve something like this
When my player is speaking or listening, some icon will popup above its head, I think a bark UI can perfectly fits in such situation.
But since the bark UI has a fixed duration, how do I set its duration dynamically from script based on every dialogue entry's duration? Basically I can use OnConversationLineEnd() to manually turn off the bark UI, but How do I for the bark to stay until it is called to disappear?
Another question is that what is the easiest way to change bark UI's text to an icon? use getcomponent to get its text mesh GUI then change it manually? or your engine has its built-in way? tks
User avatar
Tony Li
Posts: 21676
Joined: Thu Jul 18, 2013 1:27 pm

Re: set bark duration from code

Post by Tony Li »

Hi,

You can configure a bark UI to wait until the player clicks a continue button and/or wait until the bark's associated Sequence ends. If you tick Wait For Continue Button, make sure to add a continue button to your bark UI and configure OnClick() to call the bark UI's OnContinue() method. To manually hide a bark UI, call its Hide() method.

Note: By default, in the Dialogue Manager's Display Settings > Bark Settings, Allow Barks During Conversations is UNticked. You may want to tick this if you want to show a bark while a conversation is playing.

An easy way to change a bark UI's text to use icons is to use TextMesh Pro. See TextMesh Pro Support. Then use <sprite> tags. Alternatively, if you always want to show one specific icon, you could just add an Image to your bark UI that shows that icon.
Post Reply