Jump to content

[error] Cannot read property 'Spine' of undefined


palanolho
 Share

Recommended Posts

hey guys,

 

I've recently updated to spine 3.8.0 and my spine work stopped to work and throes a "Cannot read property 'Spine' of undefined"

This is what I have on my code:

//...

const pixiLoader = PIXI.Loader.shared;
pixiLoader
    .add('spineChicken', 'images/spine_animations/Chicken.json');

//...

var anination = new PIXI.spine.Spine(pixiLoader.resources.spineChicken.spineData);

 

  • I 'm using pixi JS 5.2.0
  • I have the pixijs-spine.js v 3.8.0 included in my project (downloaded from https://github.com/pixijs/pixi-spine)
  • The code was working before (I'm just trying to update the pixi JS and spine versions)
  • I checked the resources after they load and I can see the "spineChicken" is in the data structure

It looks identical to the examples on git and on the pixiJS website, so i0m understanding why this error :( 

Any ideas?

 

Many thanks in advance.

 

Link to comment
Share on other sites

 "Cannot read property 'Spine' of undefined"

does PIXI has "spine" property? if not, make sure that pixi-spine.js is loaded. If you dont know how to do it - look in devtools network tab, look if it was actually loaded. if its loaded - look if it actually has same contents than pixi-spine.js, it might get screwed by your web-server.

Why am I that sure that "PIXI.spine" cant be undefined? Because of this line: https://github.com/pixijs/pixi-spine/blob/master/dist/pixi-spine.js#L8742 Its set there. Please place breakpoint there and see if its actually called.

What can also go wrong? Someone can override PIXI global var after spine was loaded. Check if it happens.

If its not enough, you can zip everything and send it to me to check whats wrong.

Edited by ivan.popelyshev
Link to comment
Share on other sites

Good :)

Anyway, I uncommented "add('Chicken" line and got this in console:

SkeletonJson.ts:60 PixiJS Spine plugin supports only format for Spine 3.8. Your model has version 3.6.53. Please look in pixi-spine repository README for another branch.

I put this notice in pixi-spine because people often use exports from different spine versions, and then report bugs.

Chicken is 3.6, spineboy is 3.3. Both should be loaded in 3.7 version, probably, this branch: https://github.com/pixijs/pixi-spine/tree/pixi5-spine3.7

Link to comment
Share on other sites

Tries to switch to Spine 3.7.0 as you suggested (but still using PixiJS 5.3.3) but it seems it still doesn't work. Sometimes I get the same "spineData not found other times it takes a lot if time to load and end up with this error:

GET http://localhost:8000/spine_animations/Chicken.atlas net::ERR_EMPTY_RESPONSE       Resource.js:676 

Tried to downgrade to PixiJS 4.4.5 (as suggested on the pixijs-spine 3.7) but i'm getting other errors

Spine.ts:14 Uncaught TypeError: Cannot read property 'prototype' of undefined
    at Spine.ts:14
    at Spine.ts:704

 

I tried all combinations for Pixi JS and Pixijs-spine and still the same thing :(
 

Don't know what else to do :(

 

Edited by palanolho
Link to comment
Share on other sites

I gave you link to specific branch  https://github.com/pixijs/pixi-spine/tree/pixi5-spine3.7

I tried it, changed "fighter_1" to "spite_char" and got this:

2020-11-22-01-18-59-Blp80.png

the branch is named "pixi5-spine3.7". It works. I'm the one who does almost everything in this repo. Its too much time for me to manage releases, so releases are old, and if release says "this version shoudl work with pixi4" - yeah, probably it should, but that doesnt mean there's no pixi5-spine3.7 . I dont understand why did you think that 4.4.5 is the latest pixi v4, the latest v4 is 4.8.9

I don't have access to a Spine key anymore. 

If you ask esotericsoftware guys, the first thing they'll ask whether you have a license ;) 

Edited by ivan.popelyshev
Link to comment
Share on other sites

did you use the exact files I sent you with the correct version of the spine you mentioned? 

I downloaded the files from here has you requested: https://github.com/pixijs/pixi-spine/tree/pixi5-spine3.7/bin

and fixed the "fighter_1" to "spite_char" (as you did)

But I still get the "Cannot read property 'spineData' of undefined" error... why :(...

May I ask if you could zip your working version and send it to me so that I can try it? I'm starting to think it' my PC or something like that :( 

PS: really appreciate the help you are providing me and i'me happier to know that the files I have are still good and working. Apologies for any headache i'm giving you regarding this :S

Link to comment
Share on other sites

Ok, 2 things that happen:
1) I add to add the "pixi-spine.js.map" because it was complaining that could not find it and was not loading because of that (Is it supposed to work without it?)
2) i'm getting a pending loading the atlas file (?!) and because of that it's not loading. If I wait a long time, eventually it fails to load and I get error (see attached screens)

Apart from the "...js.map" i'm using exactly what you sent me.

2020-11-22_00-52-55.png

2020-11-22_00-53-37.png

Edited by palanolho
Link to comment
Share on other sites

i didnt work with fenix, i dont know )

Alternatively: there's a way to rename atlas file: https://github.com/pixijs/pixi-spine/blob/master/examples/change_atlas_extension.md

Of course you're unlucky to stumble across http-server-related problems even in hello-world app

Edited by ivan.popelyshev
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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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