Hi,
I use AddEvent on animation clip to add few AnimationEvents for a specific model.
Then I load a different scene, which have a copy of the same model.
It appears that the new model’s animation still contain the events added to a different model in a different scene.
This model doesn’t have the same Components attached to it, so I get an Exception saying that AnimationEvent has no receiver.
Isn’t this a bug? Shouldn’t all animation event added by code should be remove when changing scenes?
If not, is there a way to remove animation events, so I’ll be able to remove all animation events I added before continuing to the next scene?
Here the method that adds the event
The HasClipEvent and AddClipEvent calls are just used to keep track of the names of the event added so I wont add the same event twice
Do we have an update to this bug? I’m trying to add an animation event which only triggers the first time and then removes itself. How would you recommend I do this, particularly in such a way that I can trigger a one-shot event going either forwards or backwards in the animation. My application is to use it as a trigger to stop looping sounds with enough of a margin before the animation completion that they have a little while to fade out.
As a workaround, I ended up creating my own looping sound support and just putting repeating animation events at the start and end of animations. Did the trick.