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

Bug: Scene.onActivate and onDeactivate being called with incorrect arguments #1850

Closed
kamranayub opened this issue Apr 26, 2021 · 1 comment · Fixed by #1930
Closed

Bug: Scene.onActivate and onDeactivate being called with incorrect arguments #1850

kamranayub opened this issue Apr 26, 2021 · 1 comment · Fixed by #1930
Assignees
Labels
bug This issue describes undesirable, incorrect, or unexpected behavior stale This issue or PR has not had any activity recently

Comments

@kamranayub
Copy link
Member

Steps to Reproduce

Call engine.goToScene(scene) and have code inspecting oldScene and newScene in onActivate or onDeactivate methods of Scene.

Expected Result

oldScene and newScene should be single Scene objects

Actual Result

Engine invokes _activate and _deactivate using .call(scene, [oldScene, newScene]) which passes the array as the first argument instead of as 1st and 2nd args.

Either it should be .call(scene, oldScene, newScene) or .apply(scene, [oldScene, newScene])

Current code:

this.currentScene._deactivate.call(this.currentScene, [oldScene, newScene]);

Environment

  • browsers and versions:
  • operating system:
  • Excalibur versions:
  • (anything else that may be relevant)

Current Workaround

Code has to manually force type to be array of scene and handle it in a hacky way.

@kamranayub kamranayub added the bug This issue describes undesirable, incorrect, or unexpected behavior label Apr 26, 2021
@kamranayub kamranayub added this to the 0.25.0 Release milestone Apr 26, 2021
@kamranayub kamranayub self-assigned this Apr 26, 2021
@github-actions
Copy link

This issue hasn't had any recent activity lately and is being marked as stale automatically.

@github-actions github-actions bot added the stale This issue or PR has not had any activity recently label Jun 26, 2021
eonarheim added a commit that referenced this issue Jun 27, 2021
Closes #1850

## Changes:

- Call onActivate/onDeactivate with the correct arguments switch from call -> apply
- Add a test for this
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 stale This issue or PR has not had any activity recently
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant