In our previous game War for the Overworld we made extensive use of the Animation Clip Events available in the Animation Importer to drive a huge amount of audio and vfx cues for things like footsteps and attacks at the exactly correct frame/time. This was for over 65 characters, each with their own set of 10 or so animation clips, each bundled up into a Mecanim controller.
For each clip we have to setup these events in the tiny and infuriatingly nitpicky event timeline:
It is quite a pain to work with unfortunately, and I believe its history is one where the Unity developers had completely forgotten people might require events in Mecanim and put it together a patch or two after releasing Mecanim itself.
It is made in such a way that it is really difficult to ask our animators or other artists to do it as part of their pipeline as the information required are things like string functions. Our programmers ended up having to manage it.
What makes the tool worse is that if you replace the animation or model, you completely loose the events. Which happened often.
In hindsight we could have shared quite a few animation clips among the character rigs, however it still would have ultimately resulted in a large amount of clips that require the above work to be completed.
I had hoped that the very recent Unity Boston talk on upcoming animation features was going to enlighten me and tell me this process was old, arcane, and already replaced or about to be. However unfortunately nothing of the like was mentioned.
We’re about to start our new project and I’ll be damned if we have to go through the same animation events process we did previously. It truly was quite a huge time sink.
This thread is first and foremost a question to all: Are we missing something here? Is this the best way to do accurate animation events in modern Unity?
Assuming this is the best we’ve got, can anyone recommend any work around or tools they’ve bought or made?
Yes, unfortunately it is. The reason why its in the inspector, is because we are allowing to add events on read only clips ( imported clips) meaning that Events have to be added in the meta data and then injected into the animation clip.
Unity does plan to make a UI for events, however, we are not sure when that will be done.
I can only really suggest that you create your own custom UI for events in the meantime
hi there, how about replacing animation clip events with State Machine Behaviours? If so ignore my idea maybe doesn’t work for you.
Now your let’s say have walking animation with foot steps that are now either in imported animation clips inspector panel, or in animation editor timeline - foot steps happen on 0, 0.25, 0.5 and 0.75 of normalized time of clip.
You could maybe add a generic State Machine Behaviour that you can use on similar “events” and then add audio clip as field to it, then add maybe even curve to it that artist can tweak. Then in runtime in SMB OnStateUpdate query the state info and get normalized time and if it matches next key time play sound.
Then the replacement of animation clip wouldn’t matter, as curve/keys/values are attached to Mecanim state, not animation. Well, if you change anim clip proportions/timing you’d have to change key positions but that’s true for any solution.
Haven’t tested this specific solution but so far State Machine Behaviours have worked for me.
@Ben-Stoneman thanks for the reply. Would it be possible to get this on the radar of the developers? It seems like a small features, but it must be used by 80%+ of the Unity userbase. Its so critical to basic animation playback.
@eses yeah I had been considering that approach. I worry that it could be quite expensive though. In addition to that, it’d be a pain in the ass to add those events without being able to see where. The one thing the traditional animation clip event UI does well is the ability to move through the animation visually and put the event at that exact location.
I think what I might look into is a wrapper for the animation clip event system that stores the event data elsewhere, so it cannot be so easily lost.
@strich I will definitely champion this within Unity for you, however, I may not be as successful as a high voted feedback post.
I’d ask that you submit this as a feedback post here unless there is already a post created for this subject. If there is already a post then vote it up. Feel free to link it here for others to see.
Animation Events are still basically the same as they always have been as far as I know (except for the somewhat recent change to a dropdown menu for function names so you don’t need to type them manually).