music during a convasation

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
hrohibil
Posts: 380
Joined: Thu Nov 04, 2021 12:50 pm

music during a convasation

Post by hrohibil »

Hello Tony

I have a background music playing during the game.

How do i setup so on specific conversations, the game plays a specific music file? And when the conversations ends then the default music plays again?

Thank you
User avatar
Tony Li
Posts: 22655
Joined: Thu Jul 18, 2013 1:27 pm

Re: music during a convasation

Post by Tony Li »

If the conversation plays on a specific NPC, you can add a Dialogue System Events component on the NPC. Configure OnConversationStart() to play the music and OnConversationEnd() to resume the default music. You may need to do a little scripting to play and resume.
hrohibil
Posts: 380
Joined: Thu Nov 04, 2021 12:50 pm

Re: music during a convasation

Post by hrohibil »

Thank you

I did not need scripting.

I created a gameobject with an audiosource with the music.
My Background music was already on a gameobject with a audisource and the file on it.

So it was easy to use your systems events to ON and OFF.

Can I use a Dialogue system trigger for same thing, but whiteout any conversation? So if i enter a trigger zone i want to play a music and when i exit i resume default?
Last edited by hrohibil on Sat Dec 07, 2024 9:36 am, edited 1 time in total.
User avatar
Tony Li
Posts: 22655
Joined: Thu Jul 18, 2013 1:27 pm

Re: music during a convasation

Post by Tony Li »

Sounds good. Glad to help!
Post Reply