Continued problems with scene removal - Android device only

I am continuing to have problems with scene removal using both composer and storyboard. At a very simple level, I have two scenes “menu” and “game”.

Within the scene:show() function of both scenes under the “did” phase, I am calling “composer.removeHidden()” which should remove all other scenes apart from the current scene.

On the emulator, this behaves perfectly so performing the following “menu->game->menu->game” results in the scene:create() firing the second time the game scene is loaded (and re-initialising the game).

However, when I install on an Android device (Nexus 7 with Android 4.4), it appears that the scenes are not being destroyed meaning that the second time the game scene is loaded, it returns to the same point where the game scene was last exited.

I have tried replacing composer.removeHidden() with composer.removeScene(“game”) within the menu and also adding debug print statements around the composer entries to verify via logcat that the functions are indeed firing.

Has anyone else seen similar behaviour?

Hey Ian,

You need to post some code, because I doubt that it’s a problem in Corona. I’ve not got any experience with composer, but I have often used the following:

Storyboard.removeScene(Storyboard.getPrevious()) in a enterScene event and when going back and forth, it looks fine on android.

I’m just guessing here, but maybe you are not following the same uppercase lowercase letters ? when calling removeScene make sure you have exactly the same text as your lua file is called. “game.lua” is not “Game.lua”

I’ve had issues before where things don’t work on devices, because it’s case-sensitive, whereas on the simulator, it is not!

If all else fails, put some print statements, and take a look at the console output of your android. You should be able to pinpoint the excat place where it doesn’t work. Maybe someone with some composer experience can give you more info if there is anything that you need to look out for on that side of things?

Alex

In addition, I think the thing to remember here, is that Composer and Storyboard are just “scene managers”. They aren’t specifically “game managers”. Meaning, removing a scene doesn’t mean that the game state is reset and the player would start from the beginning when it the game is restarted. Neither Composer nor Storyboard have that intelligence baked in.

Normally, you need to code your own “reset” functionality to destroy your objects, stop music, blah blah blah. Similar to Alex up there, I’m not a Composer expert, but I still trudge along with Storyboard in a lot of scenarios, and that’s how it works there.

Thanks for the feedback Alex - doesn’t appear to be a case related issue and is especially strange as the behaviour is inconsistent, sometimes the scene is destroyed, others not when simply moving back and forth between the two scenes. I have tried adding print statements around the scene removal statements and viewed via logcat which shows that the composer.removeHidden() is being executed as expected.

I’ll attempt to pare down the code to a bare minimum and post here.

Hi Panic, what I am finding odd is that all display objects are placed into the scene display group and are not being destroyed (on the device only, emulator is fine) when composer.removeHidden() is called from another scene.

Time to do some more troubleshooting and pare the issue down to the bare minimum!

Thanks everyone for your help.

That is very strange. Are the print statements showing that, or are you seeing two (or more?) of a given object when you return to your scene?

Hey Ian,

You need to post some code, because I doubt that it’s a problem in Corona. I’ve not got any experience with composer, but I have often used the following:

Storyboard.removeScene(Storyboard.getPrevious()) in a enterScene event and when going back and forth, it looks fine on android.

I’m just guessing here, but maybe you are not following the same uppercase lowercase letters ? when calling removeScene make sure you have exactly the same text as your lua file is called. “game.lua” is not “Game.lua”

I’ve had issues before where things don’t work on devices, because it’s case-sensitive, whereas on the simulator, it is not!

If all else fails, put some print statements, and take a look at the console output of your android. You should be able to pinpoint the excat place where it doesn’t work. Maybe someone with some composer experience can give you more info if there is anything that you need to look out for on that side of things?

Alex

In addition, I think the thing to remember here, is that Composer and Storyboard are just “scene managers”. They aren’t specifically “game managers”. Meaning, removing a scene doesn’t mean that the game state is reset and the player would start from the beginning when it the game is restarted. Neither Composer nor Storyboard have that intelligence baked in.

Normally, you need to code your own “reset” functionality to destroy your objects, stop music, blah blah blah. Similar to Alex up there, I’m not a Composer expert, but I still trudge along with Storyboard in a lot of scenarios, and that’s how it works there.

Thanks for the feedback Alex - doesn’t appear to be a case related issue and is especially strange as the behaviour is inconsistent, sometimes the scene is destroyed, others not when simply moving back and forth between the two scenes. I have tried adding print statements around the scene removal statements and viewed via logcat which shows that the composer.removeHidden() is being executed as expected.

I’ll attempt to pare down the code to a bare minimum and post here.

Hi Panic, what I am finding odd is that all display objects are placed into the scene display group and are not being destroyed (on the device only, emulator is fine) when composer.removeHidden() is called from another scene.

Time to do some more troubleshooting and pare the issue down to the bare minimum!

Thanks everyone for your help.

That is very strange. Are the print statements showing that, or are you seeing two (or more?) of a given object when you return to your scene?