Byvar

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:

1. Add a float parameter
2. Go into the animation state
3. 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. :(
You do not have the required permissions to view the files attached to this post.
Byvar
  • Posts: 2

Harald

Thanks for the input, this seems indeed quite reasonable.

I have added an issue ticket here:
https://github.com/EsotericSoftware/spine-runtimes/issues/1417

[Edit]
Just noticed that you have posted again - I will check if this feature is feasible, otherwise we will have to live without it. Unfortunately, the exposed Mecanim API is not too extensive, so we'll see what we can get.

---

After a long time and Unity 2020 still not exposing the Motion Time parameter at runtime [1] via its Mecanim API, we had to close the issue ticket, sorry!

We are happy to re-open it as soon as there is a way to access the field at runtime.

[1] Only providing it for editor scripting in UnityEditor classes here.
User avatar
Harald

Harri
  • Posts: 2076


Return to Unity