Hi everyone,
I’m encountering a strange issue with Composer scene transitions in Solar2D.
I’m navigating to a scene called "sceneSalaEspera"
using:
composer.removeHidden()
composer.gotoScene("sceneSalaEspera", "fade", 200)
What works:
- The first time I go to the scene, both
scene:create()
andscene:show()
are triggered correctly. - The log output looks like this:
20250417-22:44:55>>> INFO - sceneSalaEspera - create - create - event: - {"name":"create"}
20250417-22:44:55>>> INFO - sceneSalaEspera - show - show - event: - {"name":"show","phase":"will"}
20250417-22:44:55>>> INFO - sceneSalaEspera - show - show - event: - {"name":"show","phase":"did"}
The issue:
- On subsequent visits to the scene, only
scene:create()
is triggered. -
scene:show()
is never called. - The log output for the second call is:
20250417-22:45:45>>> INFO - sceneSalaEspera - create - create - event: - {"name":"create"}
So far I’ve made sure that:
- The scene is not currently visible.
-
composer.removeHidden()
is called beforegotoScene
, to force a clean load.
Scene code:
Here’s how the scene is defined:
-- create()
function scene:create( event )
utils:log("INFO","sceneSalaEspera", "create", "create - event: ", event)
local pantallaSalaEsperaGroup = self.view
pantallaSalaEsperaGroup.background = display.newImageRect( pantallaSalaEsperaGroup, "fondoVerd.png", 694, 360 )
pantallaSalaEsperaGroup.background.x = _W
pantallaSalaEsperaGroup.background.y = _H
end
-- show()
function scene:show( event )
utils:log("INFO","sceneSalaEspera", "show", "show - event: ", event)
local pantallaSalaEsperaGroup = self.view
local phase = event.phase
if ( phase == "will" ) then
pantallaSalaEsperaGroup.pantallaSalaEsperaText = display.newText(
pantallaSalaEsperaGroup,
"Esperant als rivals...",
_W,
_H - 30,
native.systemFont,
20
)
elseif ( phase == "did" ) then
-- Code here runs when the scene is entirely on screen
end
end
Question:
Has anyone else experienced this? Is there something I’m missing about how Composer handles the scene lifecycle after the first visit?
Any tips would be very appreciated. Thanks a lot in advance!