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

Cannot disable the StatsComponent during runtime. #249

Closed
MrKou47 opened this issue Jan 8, 2024 · 0 comments · Fixed by #252
Closed

Cannot disable the StatsComponent during runtime. #249

MrKou47 opened this issue Jan 8, 2024 · 0 comments · Fixed by #252
Labels
bug Something isn't working

Comments

@MrKou47
Copy link
Member

MrKou47 commented Jan 8, 2024

Describe the bug

Cannot disable the StatsComponent with StatsComponent.enabled = false;

To Reproduce

//...
const activeCamera = engine.sceneManager.activeScene._activeCameras[0].entity;
let _statsComponent = null;
window.addEventListener("message", (e) => {
  const type = e.data.type;
  if (type === 'toggleStats') {
    if (!_statsComponent) {
      _statsComponent = activeCamera.addComponent(Stats);
    }
    const value = e.data.value;
    if(value) {
      _statsComponent.enabled = true;
    } else {
      // BUG: This code cannot disable the StatsComponent
      _statsComponent.enabled = false;
    }
  }
});

Expected behavior
The StatsComponent should be disabled, as it does not adhere to the standard behavior of other components.

Desktop (please complete the following information):

  • Browser Chrome
  • Version 120
@MrKou47 MrKou47 added the bug Something isn't working label Jan 8, 2024
@JujieX JujieX linked a pull request Jan 25, 2024 that will close this issue
3 tasks
@JujieX JujieX closed this as completed Jan 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants