- Home /
Music still playing when game has not focus ?
Hi,
I know there is a "Run in background" option, but even with this option unchecked, i still here musics when i enter alt+tab or windows+L.
So i would need a way to know if the game has the focus, or any solution that could help me stop the music. In our game, we have a system to change music through the game, basically, it's like
void Update()
{
if ((!Ambiance.isPlaying))
{
NextAmbiance();
}
}
And when i press alt+tab, the nextAmbiance is called and i play the next music anyway, and i still here music when i'm out of the game.
If someone sees a solution, it would be awesome :)
Thanks,
Well, i found a solution, i just added a timer, because i found that the "update" is just called one more time after the alt-tab, so if i wait 1 second after, the music doesn't restart :)
This behaviour is strange, but it works