No function dropdown in AnimationEvent.

Hey.
I try to handle some events during animations, but everywhere I look, every tutorial have access to AnimatorEvent Inspector like this:


A nice simple field, where you can select a function, I want this!
But instead of this, I always getting this sick 5 fields view, and don’t have any idea how to handle animation event in this case!

I tried to create function test() with debug log, but it didn’t work anyway. Why I can’t get access to this simple window where I can choose an function?

Hey!

It probably is a Unity bug (since you have some preview packages it might be them causing some bug that prevents the refreshing of unity editor to show the correct properties in the inspector).

The best solution to those kinds of issues is to just restart Unity.

The only way I was able to change the look of the info about the event is by changing the properties from Normal to Debug.

You might want to check that setting - you access it by clicking the 3 dots (marked in red on the screenshot).

Again since it is not the same screen as yours I would assume that you have some package / asset that affects how the properties of the Animation Event are drawn.

I hope this helps!

2 Likes

This means you did not select the GameObject in scene that has both:

  • the animator with the referenced animation
  • the script where the event function is located

Go select that GameObject, THEN click on the animation event (or create one).

Now your inspector will let you pick a method, based on all public methods found in the MonoBehaviour(s) on that GameObject.

The animation window, NO GameObject selected:

7987980--1026345--Screen Shot 2022-03-23 at 8.56.50 AM.png 7987980--1026348--Screen Shot 2022-03-23 at 8.56.54 AM.png

And now with the GameObject (with Animator and target script) selected:

7987980--1026351--Screen Shot 2022-03-23 at 8.57.12 AM.png

11 Likes

Thank you, that’s really helpful!

1 Like

Kurt, you are the best

1 Like

Thanks!

1 Like

Thanks, I am using a package com.unity.nuget.newtonsoft-jason for saving that causes a package error. Maybe this is the reason why had to use this working around.

I’m confused, selecting a gameobject changes the inspector to the gameobject which obviously you wouldnt have access to the animation event properties. Selecting the gameobject prior to selecting the animation yields the same result. Can you clarify what you mean please?

***Figured it out.

Just to elaborate for anyone else who may be confused, you have to select the object in the scene hierarchy, then select the animation from the dropdown menu underneath the record and preview buttons in the “Animation” window, not from the content drawer.

3 Likes

how does this work for the animation Import settings; in the Events, on the timeline, I can add the event and type the Fnction name, the animator, animation and script(funtion) are all on the playerprefab, there is not function selection and when I Play, I consistently get the same error regardless if it just the function name or I add the namespce.parent.function? Any ideas? the error is Animation Event ‘foo’ on animation ‘foo’ has no receiver!

I’m going to move this to the Animation sub-forum where it belongs. Animation is not a 2D feature.

Thanks.

Thanks for the tip. I was getting pretty annoyed :stuck_out_tongue: