Trying to add animation events to a fbx files animation, says read-only, won't save events?

Hi I bought the Animals Full Pack. It includes fbx mesh and animations for a bear and other animals.

I’m trying to add some animation events through the Animation window. But it says the animations are read-only. After I add my animations and save the scene, once I reboot unity the events are lost. Why is this and what can I do about it?

Duplicate the animation clip into its own asset. In the Project view, expand the FBX file. Select the animation clip child object and press Ctrl-D / Command-D. This will create an asset file that’s a duplicate of that animation clip. You can add animation events, edit the clip in the Animation view, etc.

1 Like

Thanks !

The clip duplication technique is very cumbersome.
With dozens of clips and the need to edit them from the program (Maya, Max, Blender etc …) becomes some problems…

The best solution is to insert the events in the animations at runtime, in the start call this simple function:

void AddEvent(int Clip,float time, string functionName,float floatParameter)
{
anim = GetComponent();
AnimationEvent animationEvent = new AnimationEvent();
animationEvent.functionName = functionName;
animationEvent.floatParameter = floatParameter;
animationEvent.time = time;
AnimationClip clip = anim.runtimeAnimatorController.animationClips[Clip];
clip.AddEvent(animationEvent);
}

For example:

Animator anim;

void Start () {
anim = GetComponent();
AddEvent(1, 0.2f, “EmitProjectile”, 0);
}

void AddEvent(int Clip, float time, string functionName, float floatParameter)
{
anim = GetComponent();
AnimationEvent animationEvent = new AnimationEvent();
animationEvent.functionName = functionName;
animationEvent.floatParameter = floatParameter;
animationEvent.time = time;
AnimationClip clip = anim.runtimeAnimatorController.animationClips[Clip];
clip.AddEvent(animationEvent);
}