Home Why does my background music stop when the player object gets destroyed?
Reply: 1

Why does my background music stop when the player object gets destroyed?

k-dhan
1#
k-dhan Published in 2017-12-07 15:18:30Z

I work with Unity 5.5.4 and I'm still learning.

My problem is when the player(object) gets destroyed(destroy(gameobject)), my backgroud music stops playing, even if I place my music in Arenamanager(gameobject), not in player(gameobject).

I don't have a function like audio.stop or something like that in my script and I already untagged the player(gameobject) and I still can't solve it.

Here is my death function:

Void Death() { 
    Instantiate(explosion, transform.position, transform.rotation);
    Destroy(this.gameobject);
}
Everts
2#
Everts Reply to 2017-12-07 15:30:44Z

Your player is most likely holding the AudioListener.

So when you destroy, there is nothing left to listen to your music.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.310827 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO