Which event is at the end of a fadind transition and before loading the next scene?

Hi, I need to clear some objects when I change the scene but I need to do it when nothing is visible, it means at the end of current scene’s fading but before loading the next scene.

  • exitScene() is before the fading.

  • isExitScene() is after the fading but it already changed the scene (you can check by storyboard.getCurrentSceneName()).

I can’t use destroyScene() because I used a required global module for all the scenes…

Any tips?

Normally what you’re trying to do should be done in didExitScene.

When using gotoScene, storyboard will always have 2 scenes loaded during a transition since it needs to be able to display both scenes at the same time during the transition. There’s no state in storyboard where one scene is unloaded first *and then* starts to load the other scene.

You could maybe implement that yourself by calling purgeScene on the first scene, and when didExitScene is fired you release your objects and then call gotoScene for your second scene. However it doesn’t sound like the correct way of doing things.

I understood there’re always 2 scenes in the same time and it’s useful when you see for example a cross fading…

However exitScene() is called before the fadeOut of the current scene and didExitScene() is called before the fadeIn of the next scene. What is missing is a call after the fadeOut of the current scene. I need it to destroy some objects (during the current scene) when all is in the dark.

Another strange thing I noticed is when you simply draw 2 white rectangles (one big on another one more little) in createScene(), so that you can see only one: the biggest. During the fadeIn time you could see the 2 rectangles instead of only one.

For a hidden objects game it’s not funny to hide images on others if during the fadIn/fadOut you can detect them :frowning:

If didExitScene() is firing too soon, then I would suggest purging the scene you’re coming from in the enterScene() of the scene you just arrived in or even removeScene() if you need to reset the whole thing.

Rob

Thanks Rob for your idea. It doesn’t help for my problem wich is complicate because of sharing modules between scenes but it’s an interesting way for controling the storyboard. For now I have another idea I must try in the module itself, like for the storyboard, it should store twice data in same time during the transitions between scenes…

Anyway I hope an event between exit1 and create2 that would be always useful :slight_smile:

Normally what you’re trying to do should be done in didExitScene.

When using gotoScene, storyboard will always have 2 scenes loaded during a transition since it needs to be able to display both scenes at the same time during the transition. There’s no state in storyboard where one scene is unloaded first *and then* starts to load the other scene.

You could maybe implement that yourself by calling purgeScene on the first scene, and when didExitScene is fired you release your objects and then call gotoScene for your second scene. However it doesn’t sound like the correct way of doing things.

I understood there’re always 2 scenes in the same time and it’s useful when you see for example a cross fading…

However exitScene() is called before the fadeOut of the current scene and didExitScene() is called before the fadeIn of the next scene. What is missing is a call after the fadeOut of the current scene. I need it to destroy some objects (during the current scene) when all is in the dark.

Another strange thing I noticed is when you simply draw 2 white rectangles (one big on another one more little) in createScene(), so that you can see only one: the biggest. During the fadeIn time you could see the 2 rectangles instead of only one.

For a hidden objects game it’s not funny to hide images on others if during the fadIn/fadOut you can detect them :frowning:

If didExitScene() is firing too soon, then I would suggest purging the scene you’re coming from in the enterScene() of the scene you just arrived in or even removeScene() if you need to reset the whole thing.

Rob

Thanks Rob for your idea. It doesn’t help for my problem wich is complicate because of sharing modules between scenes but it’s an interesting way for controling the storyboard. For now I have another idea I must try in the module itself, like for the storyboard, it should store twice data in same time during the transitions between scenes…

Anyway I hope an event between exit1 and create2 that would be always useful :slight_smile: