Typwriter sound effects play before bark begins

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
pciol
Posts: 5
Joined: Thu Jan 07, 2021 12:29 pm

Typwriter sound effects play before bark begins

Post by pciol »

Hello,

As an FYI I just started playing around with Dialogue System for Unity today :)

I had setup a basic scene where an NPC will bark some text from a database when the player approaches. I wanted the bark to have the typewriter effect with some sound blips, so I created a new prefab from the "Bubble Template Standard Bark UI" template and added a typewriter effect script to the text component as shown in the attached image.

The typewriter effect works as expected visually, however, there is a problem with the sound. Specifically, when I start the scene the two sound blips play even though I have not triggered the bark by interacting with the NPC. The two clips play just once on scene load. For reference, the sound works as expected when I do trigger the bark by interacting with the NPC.

How can I go about preventing these sound clips from playing when the scene loads? Is it possible I am assigning the typewriter effect incorrectly or in the wrong place?

Thanks,
Modified bubble bark UI
Modified bubble bark UI
Screenshot 2021-01-07 173120.png (177.67 KiB) Viewed 130 times
NPC game object components
NPC game object components
Screenshot 2021-01-07 173814.png (126.4 KiB) Viewed 130 times
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Typwriter sound effects play before bark begins

Post by Tony Li »

Hi,

Thanks for using the Dialogue System!

Does your Text GameObject have an Audio Source component? If so, make sure Play On Awake is unticked.

Also, untick the typewriter effect's Play On Enable. The bark will tell the typewriter effect when to play.
pciol
Posts: 5
Joined: Thu Jan 07, 2021 12:29 pm

Re: Typwriter sound effects play before bark begins

Post by pciol »

I have no Audio Source set, just the two Audio Clips. I notice if I uncheck the "Play On Enable" checkbox (see attached image) the sounds no longer play when the scene loads, but this comes at the cost of the typewriter effect not working altogether.

As an update I removed the second sound (under Alternative Audio Clips), but I still hear the first blip play twice.
Attachments
Screenshot 2021-01-07 173120.png
Screenshot 2021-01-07 173120.png (177.45 KiB) Viewed 126 times
pciol
Posts: 5
Joined: Thu Jan 07, 2021 12:29 pm

Re: Typwriter sound effects play before bark begins

Post by pciol »

I managed to track it down!

So the problem was that the text on the Text component had a default value of "Subtitle Text". I set this the text property to be empty (see attached image) and now everything works as expected.

I'm guessing what was happening is that the typewriter script would see that there is something in the text field and then it would begin to start playing the sounds as it wrote out the text, but at some point (a frame or two later) the Dialogue System would set text field to empty and the typewriter effect would stop.
Screenshot 2021-01-07 202102.png
Screenshot 2021-01-07 202102.png (92.42 KiB) Viewed 122 times
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

Re: Typwriter sound effects play before bark begins

Post by Tony Li »

Hi,

You can deactivate the Text GameObject. The StandardBarkUI script will activate it when it needs to show a bark. This should fix the issue.
Post Reply