Search Unity

Copying Mecanim Animation Events

Discussion in 'Animation' started by Cameron-Petty, Jan 30, 2015.

  1. Cameron-Petty

    Cameron-Petty

    Joined:
    Jan 10, 2012
    Posts:
    11
    Tried to update an old script to work with Mecanim - one that copies anim events from one AnimationClip to another by using the old AnimationUtility.GetAnimationEvents and SetAnimationEvents functionality.

    Seems to work, somewhat surprisingly, and I can access the events on the new clip after the tool runs! The method name and passed variable (including passed objects) is correct and everything.

    Unfortunately, the new events on the destination clip are not reflected in the import settings where you would normally edit them - nor does the Apply button get enabled. Tried changing something else in the settings just to get the Apply button to enable and then hitting apply, but no such luck - the new events don't get saved with the file.

    Looks like there is a $20 tool on the asset store that claims to do this (among other things), so it seems like it should be possible - but it would be nice to know how the functionality for this should work.

    Any hints?

    I'm happy to share the script with the community if I can get it working correctly.
     
  2. BryanO

    BryanO

    Joined:
    Jan 8, 2014
    Posts:
    186
    ping 2018 update?
     
  3. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,568
    If the animations are imported as part of a model (such as an FBX), you won't be able to alter the AnimationClips directly, but you might be able to access the animation events somewhere in a ModelImporter.