Animation Event Can't Find Function?

So i added a script called SpriteManager to my player and am trying to access the function
public void ChangeSprite(string animation, int frame) from an event but it is not listed. how can i access it?

sorry if i haven’t provided all the information, just that i have no idea what could even be remotely helpful. please feel free to ask!

Hey,

Unfortunately, functions with multiple arguments don’t seem to be supported with animation events. After some quick googling, there seems to be different workarounds, but I’ve never tried any of them.

The simplest and probably least efficient workaround would be to use two different animation events, one for the string, and another for the int, and then pass those into the “ChangeSprite” function.

damn unity sometimes amirite.
well at least now i know what the problem is!

thanks! i appreciate it!
edit in case anyone finds this thread: since i have a short list (7) of valid string inputs, i’m choosing to work around this by adding a seperate function for each of my animations, and passing in the frame parameter where necessary.

1 Like