Spine.js Integration, current Workflow and example needed

I’m currently trying to get a spine.js Integration working with Playcanvas.
As there are now different versions of the engine and the playcanvas-spine.js around I was wondering, if someone can provide me some info on the current integration and ideally provide an up-to-date working public project.
Following aspects are unclear for me:

  • Engine Version: V2 → is this already supported? I get errors like:
    Class constructor ComponentSystem cannot be invoked without ‘new’,
    Cannot read properties of undefined (reading ‘worldX’)
    with V2

  • Playcanvas-Spine.js → there are now newer versions at the github repository than in the asset-store ( 4.2 vs. 3.8), which version is now working, especially in combination with engine v.2 ?

As always, thanks for any heads up.

I have not tried in the Editor, but this example uses engine 2.5 and spine works fine: PlayCanvas Examples

I’d use spine from the repo, that is the most up to date.

1 Like

Thanks for your reply, I’ve created a public project for you to check, including 2 branches for spine 3.8 and 4.2, see:
https://playcanvas.com/editor/scene/2190877

Version 3.8 already breaks after adding the library from the asset store.
(Error: Class constructor ComponentSystem cannot be invoked without ‘new’)

Version 4.2 breaks when I add the setup.
(Error: physics is undefined, like mentioned here:
Plugin for version 4.2 is not working · Issue #91 · playcanvas/playcanvas-spine · GitHub)

As far as I can tell, there is currently no working version with Playcanvas Editor (Engine Version 2) and Spine.js

I hope this helps, thanks

Any update on this @mvaligursky ?
I’ve also linked this post to github bug-report.

Hi @Rechi - indeed something seems busted. I’ve created an issue for @Mark_Lundin to investigate when he’s back next week. Sorry about it.

1 Like

Perfekt, thank you very much.

Hey @Rechi. I can see you’re editor example, but no 4.2 branch?

Hi @Mark_Lundin, thanks for the reply.
I see both branches, see screenshot. Or did I mess up some branching or else?

Hey … so I tried to create a new spine 3.8 project in the editor and it works. We had a crash (with no impact) in the editor when the playcanvas-spine.3.8.js was added, but it worked during playback fine. See the project here: PlayCanvas 3D HTML5 Game Engine

This has new script and new playcanvas-spine.3.8.js file.
Grab those from playcanvas-spine/build at main · playcanvas/playcanvas-spine · GitHub

I have not tested 4.2, as I dont have data handy to test, but I assume it would work as well.

Thanks, I will take a look into that.

Thanks @mvaligursky, your project works. One thing is quite odd:
When I create a new project and add the spine integration per asset store i sometimes get a minified version (playcanvas-spine.3.8.min.js) and sometimes a non minified version (playcanvas-spine.3.8.js). The different versions are already presented in the preview of the script file before the import (one line of the minified version vs. multiple lines for the regular one). As I had the minified version in my non working example I assume I may had gotten a non working version. I have now tried importing the scripts into exisiting and new projects and get a minified / regular version at random. But both versions seem to work now anyway. Is it possible that some kind of browser caching or else could influence which version of the library gets added?

I switched the project to the 4.2 Branch, here you should also find assets exportet in spine 4.2. as well as the manually added spine integration 4.2. which results int the “physics is undefined error”.
Please let me know, if I can provide anything else.

https://playcanvas.com/editor/project/1315740

Thanks.

The issue with minified was me. I updated the store item with playcanvas-spine.3.8.js. I realized my mistake and uploaded minified version. You probably got it from store during that time.

I cannot fork it, as only main branch is forked. Can you please merge it to main.

@mvaligursky Done.

thanks, problem confirmed. I updated the ticket, but there is no ETA on the solution: Plugin for version 4.2 is not working · Issue #91 · playcanvas/playcanvas-spine · GitHub

Feel free to find our more detail on what needs to be done.

In the meantime, please use spine 4.1

1 Like

Thanks. At least we still have a working integration.
Last questions: For spine 4.1 I probably use playcanvas-spine.4.1.js from the repo? Could you please add an info about the last working version at the playcanvas +spine tutorial and/or the playcanvas-spine repo. That could save other users some time.
Thank you very much for your time.

Yes, the repo is the most up to date, but personally I’ve tested 3.8 and 4.0 only, somebody else added 4.1, so fingers cross it works, please ping here with your findings.