physics.stop() and composer.remove("scene") not working for me

I have a ball which hits another object in scene 1, and then goes to scene 2 and does the same thing for 3 more scenes.

but the problem is that, while in scene 2, the object from scene 1 is still actively hitting the object which makes it switch scenes, causing my program to crash.

i have tried composer.removeScene(“scene1”) in both scene 1 and scene 2, but still no success.

i have also tried physics.stop in scene hide, in the did phase, but still no success. Please help  thank you

I would put

composer.recycleOnSceneChange = true

In your all of scenes towards the top

This may increase loads times, you could try moving the objects very far away.

The reason why loads times may increase is because we are telling the composer library to dump our scene instead of keep it in memory.

Can you post the full error message you’re getting?

Also  you cannot remove the scene you’re currently in. Either remove the scene before you go to it or remove it in the scene you just went to after the scene is loaded and on screen (scene:show()'s ‘did’ phase.

The recycleOnSceneChange is a good option as long as you’re not doing things in the scene’s main chunk. That code will not be re-executed unless the module has been un-required (which composer.removeScene() does).

Rob

solved it thx guys, some problems were my  bad coding, also composer.remevescene(“scene”) in the scene:show did phase did the trick. ALSO, make sure to declare all your variables in the beginning, that was also one of my problems. :smiley:

thank you guys

I would put

composer.recycleOnSceneChange = true

In your all of scenes towards the top

This may increase loads times, you could try moving the objects very far away.

The reason why loads times may increase is because we are telling the composer library to dump our scene instead of keep it in memory.

Can you post the full error message you’re getting?

Also  you cannot remove the scene you’re currently in. Either remove the scene before you go to it or remove it in the scene you just went to after the scene is loaded and on screen (scene:show()'s ‘did’ phase.

The recycleOnSceneChange is a good option as long as you’re not doing things in the scene’s main chunk. That code will not be re-executed unless the module has been un-required (which composer.removeScene() does).

Rob

solved it thx guys, some problems were my  bad coding, also composer.remevescene(“scene”) in the scene:show did phase did the trick. ALSO, make sure to declare all your variables in the beginning, that was also one of my problems. :smiley:

thank you guys