spine setAnimation报错

版本 3.8.3

minerNode.getComponent(sp.Skeleton).skeletonData = spine;
minerNode.getComponent(sp.Skeleton).setAnimation(0, “attack_melee”, true);

报以下错:
Uncaught TypeError: Cannot read properties of null (reading ‘data’)

这种常用的都能报错,真的让人对cocos失去信心

输出看看 spine是否valid

你确定不是你自己的原因么,别拉屎不出怪xx

错误提示怎么看都是minerNode.getComponent(sp.Skeleton).skeletonData他为空,检查下获取代码吧

spine现在有bug,应该是要在onEnable之后才能调用setAnimation

2赞

这个是正解,start里调用就没有报错了

有遇到过一种情况 spine.isValid=true,spine.active=false;skeletonData会报这个错

难受啊,现在都不知道怎么用spine了,我的是节点上挂的spine,然后实例化10个这个节点,播放不同的动画,也是报这个错。那我什么时候去播动画合适呢

打印有值也报错,我服了啊

我就是这个原因踩得坑,cocos 到现在都还没优化处理么?