Animation Event not working with the warning

My Animation event is not working and gets a warning stating “Some functions were overloaded in Monobehavior components and may not work as intended if used with Animations Events!”

Can someone explain how to use the animations without being overloaded in MonoBehaviour?

Thank you!

I have seen this once before. To fix it, you need to understand what “overloaded” means. Perhaps you do, in which case this is for those who don’t!

Take something such as Physics.raycast. In some cases, the first parameter is a Vector3. But in others, it’s a Ray. If you look at the documentation, there are 4 versions of the same function, with different parameters in each case. The compiler knows which to use because of these different parameters, and the presence of these versions is called overloading. Overloading is a type of Polymorphism, a tenet of Object Oriented Programming.

What has this to do with your problem? The last time I saw this problem it was because a student had defined the same named function twice in his code - one with 1 parameter and one with 2. Have you accidentally done multiple definitions of the same function/method? If you did, Visual Studio wouldn’t complain because it would assume you were doing overloading, which is a perfectly valid thing to do.

Animation is complaining because it probably doesn’t know when overload to use or might guess, hence the “may not work as intended”.

Hope that makes sense!