-
-
Couldn't load subscription status.
- Fork 235
Description
- axmol version:
- devices test on:
- developing environments
- NDK version: r23c
- Xcode version: 14.2+
- Visual Studio:
- VS version: 2022 (17.9+)
- MSVC version: 19.39+
- Windows SDK version: 10.0.22621.0+
- cmake version:
Steps to Reproduce:
This issue was raised in the discord server by @AlexandreK38
With normal scene switches, using pushScene or replaceScene, this is the sequence of calls and value of getRunningScene():
1. oldScene->onExit(), getRunningScene() = oldScene
2. newScene->onEnter(), getRunningScene() = newScene
If using transitions, this is what happens:
1. oldScene->onExit(), getRunningScene() = oldScene
2. newScene->onEnter(), getRunningScene() = oldScene
So, there is a difference in the value returned by getRunningScene() when using transitions. It should be the new scene, since onEnter() may have code that impacts the new scene (such as adding child nodes etc.).
The suggestion is to change the implementation of Director::setNextScene(), which will ensure that calling Director::getRunnningScene() in onEnter() will always return the new scene, regardless of how the scene switch occurs (push/replace or transition).