How do I disconnect playables used by a mixer in the Playables API?

I have a case where I want to blend between two animation controllers. For example, in a Sims game I might have an animation controller for cooking and another for bowling. A character could have about 50 animation controllers but only one needs to be activate at a time. I could add all controllers to a mixer and it works fine but I seems a bit excessive to have all the controllers existing at once.

I’m basically after a method like Blend(newAnimationController, duration). I tried running just one controller then using a mixer to blend to another (two channels). After the blend finishes it plays the clip directly e.g playableOutput.SetSourcePlayable(cooking); Because I called playableGraph.Connect(activePlayable, 0, mixerPlayable, 0); I need to call playableGraph.Disconnect(activePlayable, 0); I seem to get this message “Cannot change inputs on playables where canChangeInputs is false.”

Is there a setting I’m missing or do I need to create a new mixer?

1 Like

Try playableGraph.Disconnect(mixerPlayable, 0), to disconnect mixerPlayable’s input #0. Disconnecting activePlayable #0 is trying to disconnect one of the AnimatorControllerPlayable’s inputs, which are read-only.

The documentation is for Disconnect is wrong: it says the argument is the source playable, but it’s actually the destination playable (which makes more sense to me anyway). Might want to file a bug.

A better name for the function would be DisconnectInput(), so there can be a DisconnectOutput() on the other side and it’s always clear what you’re disconnecting.

2 Likes

Thanks, that fixed it. I’ve included the test code in case anyone’s interested in blending between animation controllers.

3189672–243529–ACTransition.txt (3 KB)
3189672–243530–ACTransitionTest.txt (689 Bytes)

3 Likes