pixijs/spine

Uncaught TypeError: Cannot read properties of undefined (reading 'Spine') with PIXI.Spine

ericliyee opened this issue · 0 comments

Environment:

PixiJS Version: 6.0.4
Pixi-Spine Plugin Version: 3.1.2

Description:
I'm encountering an issue where the PIXI.spine.Spine class is undefined, leading to a TypeError when attempting to create a new Spine animation instance. The JSON for the Spine animation appears to be loading correctly, but the creation of the Spine instance fails.

Steps to Reproduce:
1.Include PixiJS and Pixi-Spine scripts:

<script src="https://cdn.bootcdn.net/ajax/libs/pixi.js/6.0.4/browser/pixi.js"></script> <script src="https://cdn.jsdelivr.net/npm/pixi-spine@3.1.2/dist/pixi-spine.js"></script>

2.Load a Spine animation JSON:
app.loader
.add('spineAnimation', 'http://192.168.254.8:8080/json/tuzi.json')
.load(onAssetsLoaded);
3.Create a Spine instance in the onAssetsLoaded function:
function onAssetsLoaded(loader, resources) {
const spineAnimation = new PIXI.spine.Spine(resources.spineAnimation.data);
// ... other code ...
}

Expected Result:
A Spine animation instance is created successfully.

Actual Result:
A TypeError occurs: Uncaught TypeError: Cannot read properties of undefined (reading 'Spine').

Additional Information:
I confirmed that the JSON file is loaded correctly. The issue arises when attempting to create a new instance of PIXI.spine.Spine. Any advice or guidance on this issue would be greatly appreciated.