Not being able to save the state of animations in the same way you can save transforms, visibility etc has long been a pet peeve of mine - and others, I'm sure.
The main issue is that there's so much that can go wrong with an automated solution that it's always been better to just go down the "OnLoad" route to set up animation manually because - though a little annoying - it's at least guaranteed to work. Still, updates to Unity's API and documentation have led me to try this again.
This time, though, I'm opening it up to a public "testing" phase to see if it's stable enough to be included in AC officially. It's one of those features that would easily get relied upon and forgotten about - so it's not something that can be added in on a whim.
So! If you want to help out with some testing, you can download the experimental "RememberAnimator" component here:
RememberAnimator.unitypackageTo use it, just place on the same GameObject as an Animator component, and cross your fingers it actually saves/restores the state of it when loading a save game!
A couple of caveats:
- This is for Mecanim only. Legacy's API is even more complicated to wade through, so this is for Animator components, not Animation.
- Transitions will not be saved. Parameters, layer weights, and animation states will be. If an Animator is saved mid-transition, then it will look to the clip it's transitioning to as the clip to save.
If anyone's brave enough to test it, please let me know how you go!
Comments
The script is not compatible with Unity 4, it seems. You'll have to get 5 if you want to make use of it - the version of AC is irrelevant.