Looking for a good workflow for mixing animations with code

We’re constantly facing this scenario while working on our game: we need to play an animation, and have that synced with some code running, which in turn will trigger other animations, and so on…

I’m aware of coroutines and animation events (can we rely on these anyway? or they may skip?) but even with these, it’s still hard and have an “overview” of a complex process of animations/code that should be played, let alone control that process and the timing of the different parts.

I’m looking to hear from others’ experiences - how are you handling your code and animations interactions? do you have any good tips ?

Also - is the Playables API going to help us with this ? or was it meant to do other things ? (i haven’t used it yet, and i am not sure what it should be used for).

bump ?

State Machine Behaviours were designed for this purpose. In my experience, they work pretty well.

In my games, I just using Animation Events. I’ve heard if you blend or fade between animation states, some events may have trouble firing, though I’m not doing any of that so it works for me for now.

Though I might switch to State Machine Behaviours! I hadn’t seen these, and they look to be exactly what I need! Thanks!

We are also using state machine behaviours, but the workflow is still far from perfect.
For example, consider a part in our game where a transition occurs, and so we start a sequence of:

  • animation1
  • call some code to setup something
  • animation2
  • (during animation2, some more code executes)
  • animation3 … animation N

The current issues i have with state machine behaviours are scheduling code to execute during an animation clip (not when it starts / completes). with Animation events, you can drag and drop the event to execute anywhere within the clip’s boundaries. With state machine behaviours you could probably achieve the same, but its all done in code and you lose the nice “overview” of watching the whole thing and positioning the “code” parts accordingly.

Another issue is that there’s no “high level” timeline sort of view for a whole sequence of animations. The best example that comes to mind is something like Cubase:
2935557--217116--upload_2017-1-26_9-9-1.png

In the case where i have a complex set of animations that should be played in a particular order / timings, there’s no 1 single location where i could view the entire sequence as a whole and play with it until it works the way i want it to.

It would be great to have such a view where all things related to animations (including code execution) could be presented and moved around.

I am not sure that the “director” project is what i am talking about here, but it might be :slight_smile: we’ll wait for it to see…