You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is actually as expected, as that might be the desired behavior for the audioplayers plugin. Agreed it's not the most usual for a game, but the fix is easy enough! The Game class has a listener for changes in the app lifecycle, which can hook to resume and paused. You can also stop your update logic with a flag variable as well, so that your game doesn't update while on background.
Just implement it in your BaseGame, something like this:
@overridevoidlifecycleStateChange(AppLifecycleState state) {
if (state !=AppLifecycleState.resumed) {
// pause your updates// pause all audio players
} else {
// resume your updates// resume all audio players
}
}
Thank you for replying. Sorry it took me 2 days to come back here, I wasn't able to access the PC for that time. Being new to app development I didn't know about AppLifecycleState. Thank you so much for the solution, and really sorry for bothering you with the issue, I am closing the issue now 😅
No description provided.
The text was updated successfully, but these errors were encountered: