Animation Event show a lot of function but not the function i created

Hello guys,

i wanna add my method that i have on my script at Gamecontroller object, but when i add an event inside the animation it doesnt show the method i needed just a lot of function from unity itself, like this:

i have tried to add the script to the gameobject where the animation is but still the same,
what did i do wrong here?
Thank you

Is your new method public?

1 Like

yes, it is public already

Okay was dumb of me, i attach the script to wrong gameobject … turn out attaching it to the gameobject itself is working

Thankyou

1 Like

I also had a similar problem. But it turned out that the function prototype must meet certain requirements. Help link: Unity - Scripting API: AnimationEvent

  1. The method must be public.
  2. Animation events support method that take zero or one parameter. Two or three parameters you can’t do !!!
  3. The parameter can be a float, an int, a string, an object reference, or an AnimationEvent. For example, a parameter cannot be of type bool or byte !!!

Why and why such strange restrictions are made is not clear…
Probably religion does not allow to do it normally…

2 Likes

Very nice, i have to make another function just because AnimationEvent does not take a parameter as bool…