I’m having some difficulty conceptualizing how achieve what I need using Playables. I’m hoping someone with some experience can offer some guidance.
I need a sub-state machine where the transitions and the length of those transitions are set at runtime. I need a number of these state machines that are used at different times, each with similar structure but different clips and different transitions.
Just to double check, I tried just using mecanim first. Override controllers allow me to change clips, and Animator.CrossFade allows me to create the transitions, but CrossFade doesn’t cope with interruptions. I thought there may be a way to deal with interruptions, but at that point I figured playables would be a better investment.
I’ve started to work on a playable for this system, but I’m not sure of the best way to proceed. None of the examples really deal with how to replicate a mecanim state machine, and the looking at my animator controller in the PlayableGraph Visualizer, the structure is obscured by Playable nodes which I can’t see into (but I think suggest an answer to my first question).
What I have put together with help from the examples is the ability to transition from my animator to a playable, and to transition from one clip to another clip within the playable. Beyond that I’m not sure of the best way to structure the playable graph for best results.
- Should I just have all the clips connected to a mixer in one playable, or is it better to have a different playable for each state?
From what I can tell, having all the clips in one playable is more like a blend tree than a state machine so I’m tending towards a playable for each state. What confuses me is that looking at the PlayableGraph Visualizer for my animator controller shows each mixer with 2 inputs - an animation clip and a playable - and I’m not sure what each represents.
-
Is there a functional difference between pausing a clip and stopping a playable?
-
To replicate mecanim transitions should I
a) start playing the second clip/playable
b) blend between the current/first clip/playable and the second one
c) stop playing the first clip/playable? -
Is PlayableDirector useful for this case? It looks like it might be useful as part of my Playable Controller but I’m not sure if it needs a timeline.
Edit: Another question.
- For my sub-state machines, what are the benefits of creating separate PlayableGraphs for each as opposed to housing all of them in a single PlayableGraph, and vice versa? They’ll be disposed of as a group rather than individually, but are there performance implications?