Transition to new scene using Director, pausing/disabling old scene

13 views
Skip to first unread message

maf

unread,
Jul 16, 2015, 11:36:10 AM7/16/15
to fla...@googlegroups.com
In thinking about this post I've answered the question so here's what I came up with in case it helps anyone:

In transitioning to a new scene from an existing scene, I would like to disable interactivity and effectively pause the existing scene to ensure that nothing happens as the scene is transitioning out (script actions calling functions, animations, user interactions etc) The docs state that "Only the front-most scene receives game updates" but as far as I can tell this is not the case and there is no signal on a Scene relating to when a Scene is starting to transition out (hidden emits when it is removed on completion of transition - might it be more useful to emit this at the beginning of the transition as we already have Component.onRemoved()? )

I've ended up replacing any calls to director.unwindToScene with a method:

function setCurrentScene( scene : Entity, transition : Transition = null )
{
var currentScene = director.topScene;
if( currentScene != null )
{
currentScene.add( new SpeedAdjuster( 0 ) );
}
director.unwindToScene( scene, transition );
}

The speed adjuster effectively stops all updates to the scene Entity, which also seems to prevent interactivity although I'm not quite sure why at the moment - any thoughts?!
Reply all
Reply to author
Forward
0 new messages