I have a script and animator in the same GameObject, some of the methods show up but not the one I want. I believe it is because of the amount of variables I have for my desired method. It has 3 variables. And after testing it with only one variable it appears, but adding a second one causes it to disappear.
1 Like
From the documentation on Animation Events:
This function can be in any script attached to the GameObject but must only accept a single parameter of type float, int, string, an object reference, […]
You can only have a single parameter, this is a hard limitation of animation events.
Since the event is part of the Animation Clip asset, you can also only reference other assets, not scene objects. Passing a Transform
to animate therefore isn’t possible, since that would be a scene object.
You’ll have to work around these limitations. E.g. add a script for each event that has properties to configure the references. Or pass a string that contains the necessary information and then parse that information in the event handler.
1 Like