Change/switch scene outside of function

So, if i change layout with this.scene.start(‘game’) inside class it’s working fine.

But if i use self.scene.start(‘game’), with “self” to store or replace “this”. it’s return both scene to show, ex: menu and game combined, and “menu” scene are on top of screen, “menu” scene should be changed to “game” and completely removed.

So, i want to show pre-roll ad, Player click ‘play’ button on “menu” scene, -> Show ad -> Go to “game”.
Ad sdk/functions are on outside of class/game functions.

How to do this?

Thanks

Which this object are you setting your self variable to? Both the Game and the Scenes have a scene property on them, but it behaves differently. In a Scene, it’s a Scene Plugin with a start method which will stop the original Scene. In the Game, however, scene is the Scene Manager, whose start method only starts a Scene because it can’t know whether you want to stop another one.

Assuming that you’re actually referencing the Scene Manager, you have to use the stop method to shut down the current Scene alongside the call to start for the new Scene.

I set ‘self’ to ‘this’ on boot/load scene.

Now, i set ‘self’ on game / menu scene. and it’s working.

I don’t know if ‘this’ if different for each scenes.

Thank you!