EsotericSoftware / spine-runtimes

2D skeletal animation runtimes for Spine.
http://esotericsoftware.com/
Other
4.43k stars 2.92k forks source link

[ts][pixi-v8] Spine pipe throws errors when renderable not found #2692

Closed alvov-evo closed 2 days ago

alvov-evo commented 6 days ago

At certain cases* validateRenderable and/or updateRenderable methods of SpinePipe.ts seem to be called before addRenderable.

This means this.gpuSpineData[spine.uid] is undefined there, and then a runtime error is thrown when slotBatches property of it is accessed (for example, here https://github.com/EsotericSoftware/spine-runtimes/blob/5e80111b8776f2e4de0f809527dd510f1039ce72/spine-ts/spine-pixi-v8/src/SpinePipe.ts#L127C32-L127C52).

(*) "At certain cases" means that I failed to understand what exactly causes this, nor could I reproduce it in a sandbox. So I'm not even sure that the fact that e.g. validateRenderable can be called before addRenderable is a valid case or a bug.

Nevertheless, maybe it would make sense to put additional checks to SpinePipe? Something like:

const gpuSpine = this.gpuSpineData[spine.uid];
if (!gpuSpine) {
    return false; // or just `return;`
}

Thank you.

davidetan commented 6 days ago

Hello and thanks for reporting this.

I saw that you opened this issue in the pixi repo more than a month ago. In this month we did several changes to the library, is this issue still happening with this updated version of the library?

We could add an if there, but I want first to check the reason why this is happening and fix the source of the problem possibly.

alvov-evo commented 2 days ago

Thank you for the response!

Indeed if I use the latest version I can't reproduce the issue any more. Previously it also wasn't very consistent, but still I think it's gone for good now.

Apologies for not trying out the updated version before re-creating my issue 🙇

Closing this.

davidetan commented 2 days ago

Cool! It's great to know that the problem has been solved. And if the problem will ever appear again, we can investigate it more deeply.