playMaker

Author Topic: keep playing music only in menu [SOLVED]  (Read 834 times)

marvoc

  • Playmaker Newbie
  • *
  • Posts: 37
keep playing music only in menu [SOLVED]
« on: October 06, 2021, 04:11:47 PM »
Hi guys,
 I red how to keep playing music through the menu, even how to dont duplicate when I change scene in menu. But I have problem how to turn it off once Im in game level.

Using DontDestroyOnLoad on Audio object in Menu (where is my audio playing) + Singleton from Ecosystem to dont duplicate it when Im on different page (scene) in menu.
Problem is when Im going to game level, because this Audio in the scene from DontDestroyOnLoad is still there.
I tried to destory this object, but when I came back to the Menu, my Audio wasnt there at all....

Any hint how to reslove it? :)
« Last Edit: October 07, 2021, 03:18:03 PM by marvoc »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: keep playing music only in menu
« Reply #1 on: October 07, 2021, 08:22:49 AM »
Hi.
You can set the audio object as a global or find the object (from other scenes) on start.

the use send fsm event (by name) and make a global transition to a state with a Audio stop action.

You can also try Delete Singleton Reference if you destroy the the object.

marvoc

  • Playmaker Newbie
  • *
  • Posts: 37
Re: keep playing music only in menu
« Reply #2 on: October 07, 2021, 03:17:01 PM »
Hi djaydino,
 thanks for your tips.
Audio didn't create again in the Menu when I came back from game because I didn't delete Singleton.

I dont fully understand because of this :)
Otherwise on beginning in each game level sending destroy event to Audio -> Destroy itself +
Delete Singleton Reference and everything works fine :)

Martin