Playable API - 5.2 Experimental feature

I was hoping someone here, maybe even folks from Unity could give me a few more pointers regarding the Playable API.

A while ago I found this via IntelliSense, as the Animator is now deriving from DirectorPlayer. Now since Unity 5.2. the API appears to be semi-official, as it is now documented as Playable API, though it is marked as experimental and not actually listed in the namespace list.

I realize that for now its primary purpose seems to be the mixing of animations and whole animation controllers. So we can combine whole state-machines in constructed weighted tree. Very powerful, though I do not have an immediate use for that.
Now the documentation also indicates that we can build customize Playable behavior be deriving from said class. Specifically, the method documentation for Playable.ProcessFrame has an example that shows it is possible to build a graph/tree that is completely data-driven instead of animation orientated. That would be incredibly awesome for BehaviorTrees and similar systems! I want this for our toolset now!

However, the example is not actually working. The line with “GetComponent().Play(…)” is a bit odd. I cannot add DirectoryPlayer as a component, because it is an abstract class. Sure, I thought, it makes sense to force people to implement their own DirectoryPlayer if they want something adjusted to their needs. So I derived a custom class from it, but that’s not working either. It cannot be added in the Editor, and also not via scripting. The error says it is not a Unity type, which I believe is telling me that I cannot have a script which derives from Behavior (that’s what DirectoryPlayer does), it must derive from MonoBehavior.

So that’s how far I got. Guess this feature is not ready yet?
Does anyone know how to make it work, just for “experimental” purposes?
Or what’s the intention with this new feature, am I crazy assuming I can be used for editor tools, such as small project-specific visual scripting purposes?

I’m rather curious what the actual scope of Playable is and why it is actually even there.

1 Like

We use the Playable API to play one-off animations rather than putting the animations in the animator controller.

However, it has some bugs if you are using a Generic rig. We found that if you have multiple layers on an Animator Controller, root motion stops working if using a Generic rig.

These issues don’t happen if you use a Humanoid rig. We prefer the Generic rig because it allows us to animate bone stretch and squashing.

We were able to get around that issue by setting the animator controller after the one-off animation is done. However, we have experience some crashing with that approach.

Has anyone tried using the Generic rig with the Playable API?

That’s what I’m trying to do. I can simply call myAnimator.Play(playableClip) to make it play an animation, which was not previously in the state machine, but how do I cleanly return to the original states? Do I have to cache the original animation and just play it or can I somehow remove the override playable animation?