Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unused scene loader fails scene transitions and locks up engine #3128

Closed
andybarron opened this issue Jul 18, 2024 · 1 comment · Fixed by #3133
Closed

unused scene loader fails scene transitions and locks up engine #3128

andybarron opened this issue Jul 18, 2024 · 1 comment · Fixed by #3133
Labels
bug This issue describes undesirable, incorrect, or unexpected behavior

Comments

@andybarron
Copy link

Steps to Reproduce

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");

Expected Result

  • Game logs should change scene and transitions to Scene2 on click.

Actual Result

  • Game logs message but does not change scene. No more events are fired (e.g. pointer move), essentially locking up the engine.

Environment

  • browsers and versions: Firefox (128.0, 64-bit), Chrome (126.0.6478.127, arm64)
  • operating system: macOS 14.5 (Sonoma) - MacBook Air (M1, 2020)
  • Excalibur versions: 0.30.0-alpha.1106

Current Workaround

Adding a fake resource to the loader fixes the issue.

@eonarheim eonarheim added the bug This issue describes undesirable, incorrect, or unexpected behavior label Jul 18, 2024
@eonarheim
Copy link
Member

@andybarron Woof definitely unexpected! Nice find!

Theoretically should be a quick fix

eonarheim added a commit that referenced this issue Jul 20, 2024
Closes: #3128

* Special case when no resources, consider it "loaded"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue describes undesirable, incorrect, or unexpected behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants