When playing my game in windows for testing, and I set group gain to zero like so sound.set_group_gain("master", 0) the game plays when I transition to a new screen / collection.
But doing the same thing on Android, whether in released to google play or debugging on Defold, the game crashes and exits to OS without displaying an error message in defold console.
My game has used this code (sound.set_group_gain("master", data.music_status)) since the initial release on google play.
I am not sure what is causing the error. But for the time being, I have to disable the “Sound off” button feature.
Its a fully released to android project. I could add you to github. Britzl might still have access. Adb reports no errors or messages. The game simply returns to home screen. No consle output either.
This only happens is master gain is set to 0 and a new sound (song) is started.
That gives me an idea. I use a variable data.music_status that might be testing nil somewhere. But the same code has been active since initial release.
I am not sure why it’s not doing it. I am using the version available on GOOGLE PLAY.
What I do is start the app and on the home screen, I toggle “sound off”. Then I click on anything that produces a sound and it returns to the OS.
Funny thing I notice this morning is that I use DefSave and when I click the sound off toggle and exit the app, it should save with DefSave. The only toggle that persists is the “show intro” toggle. Quite strange that it saves but the sound no longer saves. I do stop the sound before exiting thus could be why it does not save as it crashes.
Hmm. I recently updated the game in Google Play just on version 1.10.2 and when I was testing I didn’t see such a bug. I don’t see any crashes in Google Console reports either.
if game.sounds then
sound.set_group_gain("master", 0)
sound.set_group_gain("fx", 0)
else
sound.set_group_gain("master", 1)
sound.set_group_gain("fx", 1)
end
In any case there should not be a crash, if you pass nil (undefined variable) instead of a value, there should be an error, but not a runtime crash. (need to check it).