Harald 感谢,SkeletonRootMotion组件现在可以正常工作了,但是正如spinebot所说其他依赖于 animator 的对象也失效了,例如我自定义的动画控制脚本中的animator,我该如何编写类似SkeletonRootMotion的新Initialize函数,以及在什么时候调用来使我的脚本和SkeletonRootMotion一样继续正常工作。
顺便我还发现一件事,
当我使用脚本animator.Initialize(true);时,其他依赖于 animator 的对象以及为animator 设置的事件监听失效了
但是如果我使用SkeletonAnimation在inspector窗口中的Reload按钮,则不会失效
我能否有办法在脚本中使用Reload按钮,而不是Initialize函数
游戏运行中,是否可以切换SkeletonDataAsset
@fengmin You can register your own components to the skeletonAnimation.OnAnimationRebuild
callback to get notified when Initialize(true)
invalidates e.g. your skeleton and AnimationState
.
skeletonAnimation.OnAnimationRebuild -= InitializeOnRebuild;
..
protected void InitializeOnRebuild (ISkeletonAnimation animatedSkeletonComponent) {
Initialize();
}
You can find the same code in SkeletonRootMotionBase.cs
:
EsotericSoftware/spine-runtimesblob/4.2/spine-unity/Assets/Spine/Runtime/spine-unity/Components/RootMotion/SkeletonRootMotionBase.cs#L179
在使用SkeletonRootMotion我发现骨骼会在动画最后一帧时,回到动画的初始位置,同时使用BoneFollower 的时候,就会出现Follow的物品跟着闪烁一下,有什么办法解决吗
When using SkeletonRootMotion, I found that the skeleton will return to the initial position of the animation at the last frame of the animation.
Could you please describe that in more detail, when exactly does that happen? If it happens all the time, then root motion is not active (for whatever reasons not doing anything). Or does it revert to the initial position only once after changing your SkeletonDataAsset
?
When using BoneFollower at the same time, the Follow items will flash. Is there any solution?
Could you please describe what exactly happens? It has been translated as "flash", do you mean the BoneFollower
object's position is wrong for a single frame?
@fengmin Thanks for the additional info. Is your run animation three cycles long in a single animation? The issue seems to occurs only after the third cycle.
How is the GameObject transform position moving? Unfortunately the video shows the RectTransform tool active, with no RectTransform borders visible either. Could you please share a video where the Translate tool is active, so that we can see the GameObject origin moving?
@fengmin Thanks for the additional information and videos. This indeed looks strange, we have not yet encountered such an issue. Could you please send us a minimal Unity project which still shows this issue? You can send it as a zip package to contact@esotericsoftware.com, briefly mentioning this forum thread URL so that we know the context. Then we can have a look at what's going wrong.
Thanks for sending the reproduction project. We received everything. Please note that you should not add the project to Unity Version Control when sending it as a reproduction project. I had to manually remove the Unity Collaboration package to fix any errors. Nevertheless, I could now reproduce your issue. We will get back to you here on the forum once we know what's going wrong.
fengmin 目前我发现使用Reload按钮是最完美切换方式,但是我不知道如何在代码中调用该按钮或者编写和Reload按钮功能相似的方法
Please check out this recent forum posting here:
https://esotericsoftware.com/forum/d/26544-reload-skeletondataasset-in-runtime/2
Or this one for SkeletonGraphic
(which also shows setting initialSkinName
and startingAnimation
)https://esotericsoftware.com/forum/d/26432-skeletondataasset-swap-in-runtime-has-blue-tint/2
@fengmin We have just released a bugfix for SkeletonUtilityBone updating too late (before SkeletonRootMotion moves the bone back).
A new spine-unity 4.2 unitypackage is available for download here as usual:
https://esotericsoftware.com/spine-unity-download
Please let us know whether this fixes the issue on your end as well. Thanks for reporting.
Issue ticket URL for later reference:
EsotericSoftware/spine-runtimes2582