Add different music for game and menu, and use Singleton

i would like to know how to destroy (DontDestroyOnLoad) to use diferent music for menu and for gameplay

i add a bool in my script

thanks if anyone can help me :slight_smile:

Hi Gabus19,

That’s an interesting idea. With a little bit of research, I’m sure you’ll be able to make this work. :slight_smile:

Here is a little tip for you: Look the sceneLoaded delegate up in the Unity API, read the example and try to apply the example in your code. Do not write the complete solution immediately. Instead, log messages into your console to see if the expected code blocks get executed. Once they get executed as expected, you can play your sounds as needed.

Good luck! :slight_smile:


See also:

thanks for you tip, but i dont understand yet how to use the sceneLoaded :frowning: , anyway i found another solution, i create diferents audiosource as AudioPlayer childs and i just activate and desactivate.
seems like is working nice,

Good job on finding an alternative solution! :slight_smile:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms