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: [v8] When adding onRender to a class extension, it does not work as expected #10356

Open
adam-savard opened this issue Mar 21, 2024 · 0 comments

Comments

@adam-savard
Copy link
Contributor

Current Behavior

Currently, if you have a class that extends a Pixi object, say:

class SomeClass extends Container{}

And then you add a class definition for onRender like so:

class SomeClass extends Container{

onRender(){
    console.log('This will not work');
}

}

It won't work; this seems to be because of getters and setters being used for onRender under the hood.

What you have to do instead is:

class SomeClass extends Container{
constructor(){
    super();
    this.onRender = () => {
        console.log('This will work');
    }
  }
}

Expected Behavior

Overriding with class definitions should produce the same result, or at least this behavior should be documented

Steps to Reproduce

The steps are listed above!

Environment

  • pixi.js version: 8.0.2
  • Browser & Version: Chrome Version 122.0.6261.128 (Official Build) (64-bit)
  • OS & Version: Fedora 39

Possible Solution

No response

Additional Information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant