C
C#7mo ago
SteliosKrom

✅ How to make DontDestroyOnLoad work for only single scene?

Hello! I have a problem. In my game, when I am on my Main Menu Scene and trying to load Main Game Scene with Play button it plays the main menu background music continuously, where I dont want that to happen to more than 1 scene my options scene. When I am pressing options button and load options scene I want to hear that music of main menu to be played on options scene only and not when transitioning between main menu scene and main game scene. On my main game scene I have another scene and I hear it twice like my main game music and main menu music that still persist across all of my scenes when I am loading them. https://paste.mod.gg/ficinzjtreta/0 UI Manager script https://paste.mod.gg/htmjkrjitmsg/0 Audio Manager script where handles dont destroy on load
BlazeBin - ficinzjtreta
A tool for sharing your source code with the world!
BlazeBin - htmjkrjitmsg
A tool for sharing your source code with the world!
12 Replies
Pobiega
Pobiega7mo ago
Sounds like a question for $unity
Cattywampus
Cattywampus7mo ago
You can just manually destroy it the next time you want to change to a new scene with GameObject.Destroy()
SteliosKrom
SteliosKrom7mo ago
You mean that I can use that to destroy it when I press play button and load the main game scene? Yeah! It is question for Unity and I am on the server I just want help particularly that's why I've asked for help here.
Pobiega
Pobiega7mo ago
But it requires unity knowledge to respond to this question. Thats why I recommended you ask there, not here
SteliosKrom
SteliosKrom7mo ago
There is no people Game Developers that are working with Unity? There is a channel called game dev and that's why I am asking for help about Unity here because I know if you have a channel called game deve there will be probably game devs here.
Pobiega
Pobiega7mo ago
Sure, maybe 5 to 10% of people here know unity. 100% of the people there know it 🙂
SteliosKrom
SteliosKrom7mo ago
Don't you have knowledge with Unity?
Pobiega
Pobiega7mo ago
None what so ever.
SteliosKrom
SteliosKrom7mo ago
I came here to ask for help because I wanted a thread like I said to make this discussion private to help me someone with that issua I am dealing with thats why anyway I think the other guy has knowledge with Unity so he will help me.
Pobiega
Pobiega7mo ago
And I'm saying you are more likely to get help there, than here
SteliosKrom
SteliosKrom7mo ago
There they are not helping you privately in threads that's the problem there are people that are asking for help so many Oh, wait! I didn't know that you can make a thread there I thought there was only discussion channels and no thread but like I see there are anyway thanks I will see what the other guy has to say about that. Hey! You can close the thread I found the solution myself. Thanks 🙂