When the loadScene() callback function is bound, the information retrieved from getScene() becomes inaccurate.
Upon transitioning from the Entry Scene to the Lobby Scene, I perform post-processing tasks.
The implementation was done in TypeScript.
Entry.ts
cc.director.loadScene('Lobby', this.postProcessLobby.bind(this)(isRelogin));
The value displayed by cc.director.getScene() in the console indicates 'Entry' even though it should show 'Lobby' after scene switching.
An alternative approach uses Arrow functions to achieve the desired outcome:
Entry.ts
cc.director.loadScene('Lobby', e => this.postProcessLobby(isRelogin));
Now, cc.director.getScene() correctly shows 'Lobby' and the lobby variable behaves as expected.
While bind() worked well for asynchronous callback processing without issues, using it with loadScene() did not produce the desired result. What could be causing this discrepancy? Is the callback being triggered before the scene switch, or is there another underlying issue?