Jump to content

Issues removing Spine AnimationStateListener inside listener callback


Recommended Posts


I'm having an issue in Spine when removing listeners while events are still being fired. I've looked through the Spine code and this seems to happen because EventQueue.drain (inside AnimationState) will loop from 0 to the amount of listeners. When a listener is removed during this, the values in the array are shifted, but the iterator remains the same, skipping a listener.

Here's some example code which gives me the error when multiple listeners exist on a spine. Is there a better way to do this or is this a bug?

    eventToPromise<T extends keyof PIXI.spine.core.AnimationStateListener2>(event_: T? Promise<void> {
        return new Promise((resolve_) => {
            const animationStateListener: PIXI.spine.core.AnimationStateListener2 = {
                [event_]: () => {
                    // Only listen once
            // Listen for callback
Edited by adam.drake
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...