Music while changing scenes in unity


(Maciej) #1

Hi,
I am still fighting with integration :slight_smile:
I have 2 scenes in Unity: “a” and “b”. There is different music in each scene. I would like to fade out music “a” while i jump to scene “b”

There are trigger colliders that are changing my scenes. I am trying with parameters but i dont know if thats good idea.

Any clues how to make it work?
thx


Edit:

This video shows that in one scene trigger zones works fine but when i change scenes i dont know what to do


(Cameron Baron) #2

To use a parameter change between scenes you would need to keep the object with the event attached around, using DontDestroyOnUnload. Otherwise when you unload a scene, all the objects in that scene get destroyed, including any references to events you had.

Also when you reload scene a another instance of the event gets created, you can use the “Trigger once” on the Studio Event Emitter script to make sure it doesn’t get re-triggered, or destroy it before creating another instance.