Scene:hide() did phase not being called

Hello
Anyone knows any way/reason that the “did” phase of the scene:hide() would not be called, even after the scene is no longer visible on the screen?

function scene:hide( event )
print("here we are, in the hide SCENE")
local sceneGroup = self.view
local phase = event.phase
print("the phase is " .. phase)

produces this code in certain cases:

here we are, in the hide SCENE
the phase is will

and this code in other cases:

here we are, in the hide SCENE
the phase is did

The version is Version 2020.3611 (2020.8.20)

Any ideas?

Note: I was able to overcome it by doing a composer.removeHidden() on the next screen, but I was expecting that I would not need to do that

Tried this project with 3611 and it works for me. Can you take a look at the code and tell me if I’m doing something different?

scenes.zip (1.4 KB)

Yours works fine for me as well. And my code works fine in other cases as well. Thats why I cannot figure out why in that one instance it only does the “will” phase, and what could have made it skip the “did” phase.

I will try to minimise my code to the absolute minimum that can produce the wrong beheaviour

And by doing that, I managed to find out why it was happening:
Under certain circumstances, I change the event listener of the button that was triggering the move to the next scene.
One of the times that I was changing the event listener, I was adding the new one, without removing the old one.
So, when the goToScene was called, the other event listener (Which triggers visual effects and timer.performWithDelay actions), was still running.
Apparently, this was causing the scene not to hide.
When I fixed the double event listeners, the scene started going to the “did” phase without a problem.

Thanks for looking at this

1 Like