Hi,
After trying out SkeletonMecanim earlier today ( SkeletonMecanim: unintended behavior? ), I discovered a feature that seems missing from it and that we really need for our game project.
In Mecanim, the current time in a specific animation state can be controlled by a parameter using this setup:
- Add a float parameter
- Go into the animation state
- Next to "Normalized Time", select "Parameter" and select the parameter
As in my previous thread, I created a test project (using Unity 2019.1.0f2, Spine 3.7.94 and the latest runtime). There are two moving boxes, one animated in Unity and one in Spine. The setup in the animation controller is exactly the same. The normalized time parameter for both boxes is controlled via a slider, with exactly the same code.
spine-test-timefeature.zip
I also made a little video to show it in action: https://streamable.com/w811p
As you can see, this works perfectly with animations created within Unity, but SkeletonMecanim does not seem to support this. Please consider supporting this in the future, it would be very useful for our project. π
Thanks!
Update:
I tested and looked around a bit more, and this seems to be a Unity problem.
https://issuetracker.unity3d.com/issues/animatorstateinfo-dot-normalizedtime-returns-the-total-play-time-of-animation-state-when-normalized-value-is-set-to-parameter
AnimatorStateInfo.normalizedTime, which spine-unity uses, returns the total play time of the animation, rather than the time when the animation is evaluated. Unless you use the editor parameters (https://docs.unity3d.com/ScriptReference/Animations.AnimatorState.html) and serialize them separately, which would be a really bad workaround, there does not seem to be any way to get the "evaluation time" from the animator state, making this thing impossible to support. π