Closed andybarron closed 3 months ago
import * as ex from "excalibur"; class Scene1 extends ex.Scene { override backgroundColor = ex.Color.DarkGray; override onInitialize() { this.input.pointers.on("down", () => { console.warn("should change scenes"); this.engine.goToScene("Scene2"); }); } } class Scene2 extends ex.Scene { override backgroundColor = ex.Color.Viridian; // issue still occurs if onPreLoad is not defined or // if we call super.onPreLoad(loader) override onPreLoad(loader: ex.DefaultLoader) { // un-commenting this call fixes the issue. // loader.addResource({ // data: {}, // isLoaded: () => true, // load: () => Promise.resolve(), // }); } } const game = new ex.Engine({ scenes: { Scene1, Scene2: { scene: Scene2, loader: ex.Loader }, }, }); game.start(); game.goToScene("Scene1");
should change scene
Scene2
Adding a fake resource to the loader fixes the issue.
@andybarron Woof definitely unexpected! Nice find!
Theoretically should be a quick fix
Steps to Reproduce
Expected Result
should change scene
and transitions toScene2
on click.Actual Result
Environment
Current Workaround
Adding a fake resource to the loader fixes the issue.