Mario Hi Mario, thank you for your quick response!
I've been going through the examples and I can't see how to setup the viewer! I'm trying to see the changes on runtime, so the viewer becomes important to me.
I've been trying to implement this JSON and Binary Data load from the Runtimes API, but can't get it to work! Here is the code I'm using:
import React, {useEffect, useRef} from 'react';
import * as spine from '@esotericsoftware/spine-player';
import '../../styles/SpinePlayer.css'
function SpinePlayer ({ jsonUrl, atlasUrl }) {
const playerRef = useRef(null);
let spinePlayer = useRef(null);
let skeleton = useRef();
let atlas = useRef();
useEffect(() => {
fetch('https://esotericsoftware.com/files/examples/4.2/spineboy/export/spineboy-pro.skel')
.then(response => response.blob())
.then(blob => {
atlas.current = blob;
});
fetch('https://esotericsoftware.com/files/examples/4.2/spineboy/export/spineboy-pma.atlas')
.then(response => response.blob())
.then(blob => {
skeleton.current = blob;
})
if (playerRef.current) {
const config = {
skeleton: jsonUrl,
atlas: atlasUrl,
}
spinePlayer.current = new spine.SpinePlayer(playerRef.current, config);
const attachmentLoader = new spine.AtlasAttachmentLoader(atlas.current);
const json = new spine.SkeletonBinary(attachmentLoader);
const data = json.readSkeletonData(skeleton.current); // THIS RETURNS ERROR WHEN READING PROPERTIES OF UNDEFINED
console.log(data);
return () => {
spinePlayer.current.dispose();
};
}
}, [jsonUrl, atlasUrl, spinePlayer]);
return (
<div ref={playerRef} style={{ width: '800px', height: '600px' }}></div>
);
}
export default SpinePlayer;
Is there any way to keep going my way or this could be completely functional using the pixi runtime?
Thanks!!