Now I can hear Bad Piggies Theme in my game forever Also, suggestion, perhaps BGmusic should store a reference to its AudioSource so you won't have to call GetComponent a lot 😳
One thing I didn´t notice and might be important to notice is that the Audio GameObject with BGmusic script can´t be a child object I had my Audio as a child object and it was not working! Great video it´s simple and effective way to persist and pause audio trought the scenes.
your code doesnt work if you try to go back, like scene one is the menu with different music, and scene 2 goes through scene 10 with the repeating music, but if i go to scene 1 and back to scene 2-10 the music stops Edit: i realize why its doing this, its because the game object is destroyed so when you load the scene again, theres no music playing because there's no music to be played. but i still dont know how to fix it
Hello, this was a brilliant tutorial. I was wondering why the music I have in a scene also stops playing despite not having this script? I wish you could help me
I am having trouble getting it to stop on a certain scene. (I am new to coding so I am kinda dumb) When I put the second code into my switch scene thing it doesn't stop, I put the right name and there were no errors but it wouldn't stop. If it helps I use buttons as the menu to diffrent scenes and I tried to put the code there but it wouldn't work.
i have a problem. in first time works, but if i'm in scene 1 with music (A) pass to scene 2 with the same music, pass to scene 3 and i stop the music A because i want so hear music (B). When i return to scene 1, music (A) doesn't sound
hmm maybe you should put music B on a separate gameObject because that script checks whether there is already the same game object in the scene and then deletes it. Or you forgot to make the music continue when it reaches scene 1
@@BillyMan in scene 3 i have other Game object. I think that t'he probleme is when the music A stops in scene 3, when i retur to scene 1, continues in stop. What do you do?
@@BillyMan you mean that when i in scene 1 music A starts? I tried this, but i don't want that when i am on scene 2 Andreu change to scene 1 t'he music reload. But if is the only way...
Now I can hear Bad Piggies Theme in my game forever
Also, suggestion, perhaps BGmusic should store a reference to its AudioSource so you won't have to call GetComponent a lot 😳
man that's a really good idea
copyright
This is the most straightfoward and informational and fast pace tutorial i have ever seen, underated as heck this guy
One thing I didn´t notice and might be important to notice is that the Audio GameObject with BGmusic script can´t be a child object I had my Audio as a child object and it was not working! Great video it´s simple and effective way to persist and pause audio trought the scenes.
saved my life !
Thank you !
Oh my God thank you man, I was just about to give up on having music in the backgroud, thank you so much.
simple but effective tutorial dude
Nice! Gotta use this more :) Very straightforward to keep music through scenes it seems. Great explanation
Thank you, I'm glad you liked it :D
Underrated.. seriously also nice french skills i really love the word shit
Good tutorial! I only used the first script for my prototype, and it worked perfectly! Thank you!
This is the best tutorial ever! Good job!
Quick and great tutorial! Thanks!
where do we apply the second script? i have my audio source but it doesnt let me apply swap scene
your code doesnt work if you try to go back, like scene one is the menu with different music, and scene 2 goes through scene 10 with the repeating music, but if i go to scene 1 and back to scene 2-10 the music stops
Edit: i realize why its doing this, its because the game object is destroyed so when you load the scene again, theres no music playing because there's no music to be played. but i still dont know how to fix it
Have you found a solution?
@@omarcano6195 lookup catto devs video "how to seamlessly play audio between multiple scenes"
couldn't you fix this by deleting the "Destroy(gamobject);" line? you wouldn't need it for anything else anyways right?@@omarcano6195
Hello, this was a brilliant tutorial. I was wondering why the music I have in a scene also stops playing despite not having this script? I wish you could help me
I am having trouble getting it to stop on a certain scene. (I am new to coding so I am kinda dumb) When I put the second code into my switch scene thing it doesn't stop, I put the right name and there were no errors but it wouldn't stop. If it helps I use buttons as the menu to diffrent scenes and I tried to put the code there but it wouldn't work.
great tut!
why my music won't play again when I return from the pause scene?
where should I put the resume code so my music can play again
i have a problem.
in first time works, but if i'm in scene 1 with music (A) pass to scene 2 with the same music, pass to scene 3 and i stop the music A because i want so hear music (B). When i return to scene 1, music (A) doesn't sound
hmm maybe you should put music B on a separate gameObject because that script checks whether there is already the same game object in the scene and then deletes it. Or you forgot to make the music continue when it reaches scene 1
@@BillyMan in scene 3 i have other Game object. I think that t'he probleme is when the music A stops in scene 3, when i retur to scene 1, continues in stop.
What do you do?
@@arnauz11 maybe you can check if you're in scene 1 and use the play function like in the video to resume the music
@@BillyMan you mean that when i in scene 1 music A starts? I tried this, but i don't want that when i am on scene 2 Andreu change to scene 1 t'he music reload.
But if is the only way...
@@arnauz11 you can just check if u are in scene 1 then continue the music, if u are in scene 2 then stop, it would work just fine
thanks man
seriusly easy... thanks
thank you
THX BRO HAHAAHAH YOU A LEGEND :D
nice
thxxx
Where do I assign the second script??