For insight, now I'm trying a mix of what you said backed by the Generic Rendering, Changing Attachments Runtime Guides, as well as the Slot and Skin API references, but I'm getting null from it, even though I'm retrieving the slot and slot name correctly:
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);
useEffect(() => {
if (playerRef.current) {
const player = new spine.SpinePlayer(playerRef.current, {
skeleton: jsonUrl,
atlas: atlasUrl,
success: runSpinePlayer
});
return () => {
player.dispose();
};
}
}, [jsonUrl, atlasUrl]);
function runSpinePlayer(player){
const skel = player.skeleton;
const slots = skel.slots;
slots.forEach(slot => {
if(slot.attachment === null) return;
const attachment = skel.getAttachment(slot, slot.attachment.name);
debugger;
console.log(attachment);
})
}
return (
<div ref={playerRef} style={{ width: '800px', height: '600px' }}></div>
);
}
export default SpinePlayer;