Know when CCScene is shown after scene on top of stack is popped

92 Views Asked by At

Using `cocos2d-x, say I am on Scene 1 and I add a new scene (Scene 2), but I later pop that scene:

CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->popScene();

How do I know when Scene 1 has appeared again? Is there any sceneDidAppear method or something similar?

2

There are 2 best solutions below

1
On BEST ANSWER

CCScene is derived from CCNode, therefore you can override onEnter() and onExit() method to know when a scene is pushed or poped.

2
On

Adding to @Vikas Patidar answear : you can override onEnterTransitionDidFinish() - this will fire after the transition animation is complete. Docs : link