需求是做一个技能编辑器,我想使用 SkeletonGraphic 来预览动作,但我使用EditorUpdate来调用 SkeletonGraphic 的Update(deltaTime),使用 animationState.SetAnimation 来播放动画时,动画并不会播放(打印发现TrackEntry的TrackTime是有变化的,TimeScale 一直设置为1) :'(

== I would like to make a skill editor by using SkeletonGraphic to preview the animations, but when I using EditorUpdate to call the SkeletonGraphic.Update(deltaTime) and using SkeletonGraphic.AnimationState.SetAnimation to play animation, animation didn't play (found TrackEntry TrackTime had changed, TimeScale had been set to 1)
  • Posts: 1


EditorUpdate 仅在检查器中进行任何更改时调用。 您需要将更新方法注册到 EditorApplication.update 以在每一帧调用。

你可以查看 SkeletonDataAssetInspector.cs#L137 每帧更新预览。
EditorUpdate is only called when any changes are made in the Inspector. You need to register your update method to EditorApplication.update to be called every frame.

You can check out SkeletonDataAssetInspector.cs#L137 which updates the preview every frame.
User avatar

  • Posts: 4459

Return to 中国Spine用户