How to edit read only animations

Hello,
I have been looking through numerous solutions to this problem and im not sure they meet my situation. I have an FBX blender model that has read only animations. I need to add keyframes/events to this animation to be able to call a function. My animations are contained within my model though, so if I try to duplicate the animation like other posts have said, it is not possible. I’ve heard that if you put the model in the scene, then make a prefab of that model, then it would work, but I already have a prefab based off this model… Does anyone have any experience with this situation? I have looked at this post already:

if someone could offer a more detailed solution they used that would be awesome. Thanks,

I think I just worked this one out…

When Unity imports the FBX, the animation clip by default (at least on my Unity) is given a name like ‘Anim|Cube’. You have to rename this in the import settings for the object, removing the | characters. Then after clicking apply, you can click on your clip in the project browser, press Ctrl-D and it should give you a copy outside the object.

Hope it works,

devDoug

I’m also using read-only animations. And I’ve also tried duplicating my animations and edit them manually. But it’s troublesome. So i add my events to my animations at runtime once in Start(). For instance this is an event which calls a function with a float parameter:

AnimationEvent animationEvent = new AnimationEvent();
animationEvent.functionName = "your method name to be called"
animationEvent.floatParameter = "single type parameter you want to pass"
animationEvent.time = "time when to trigger event"
Animation["state you wish to add event"].clip.AddEvent(animationEvent);

Then define your method in your script and it will be fired off as you described.

But beware, in the presence of multiple objects with the same animation, the event is added several times because the animation is always one for all the objects.
You need to add a static variable that specifies that the event should only be added once.

    public static bool EventsAdded;



    void Start() {
        if (!EventsAdded)
        {
            AddEvent(13, 0.3f, "TriggerActive", 0); //my events
            AddEvent(13, 0.5f, "ShotFire", 0);
            AddEvent(14, 0.5f, "DeleteObject", 0);
.....
            EventsAdded = true;
        }

This should only be done if there are more objects with that animation.

Or… you can add events following this:
link