在unity中,我想直接用gameObject.SetActive(true/false)来直接控制某个spine动画的播放与停止(停止时动画消失)(SkeletonGraphic),为了实现类似unity动画中的PlayOnAwake功能,我在SkeletonGraphic中设置了startingAnimation,然后写了一个monobehaviour脚本挂载在动画gameObject上,这个脚本在OnEnable()中调用了m_SkeletonGraphic.AnimationState.SetAnimation(0,m_SkeletonGraphic.startingAnimation,false); 在OnDisable()中调用了m_SkeletonGraphic.AnimationState.ClearTrack(0);为什么在第一次播放时正常(默认gameObject的active=true),但是调用了gameObject.SetActive(false)再调用gameObject.SetActive(true)时,动画开始播放前有时会出现1帧上一次播放的最后画面,我该怎么修复这个问题?
unity-spine 重新播放时偶然会出现一帧上一次播放的最后画面
动画开始播放前有时会出现1帧上一次播放的最后画面,我该怎么修复这个问题?
The problem you are encountering seems similar to the problem in the following thread:
https://esotericsoftware.com/forum/d/17035-unitysetanimation%E3%82%92%E5%91%BC%E3%82%93%E3%81%A0%E3%83%95%E3%83%AC%E3%83%BC%E3%83%A0%E3%81%A7%E3%82%A2%E3%83%8B%E3%83%A1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%8C%E5%86%8D%E7%94%9F%E3%81%95%E3%82%8C%E3%81%AA%E3%81%84
Could you try to call skeletonAnimation.Update(0);
after SetAnimation()
?