Animations event doesn't accept any function to call

Hi I’m trying to get a particul effect trigger by a animation event.
I made a script with a function to play the particule effect.

I would like to call that function at a point of my animation.
So I added a event at the right moment, but then can’t use the event to do anything
8704839--1175457--upload_2023-1-4_16-40-38.png

How Am I suppose to fill this ? Object no gameObject.
Really frustating as in the tutorial you have a dropdown list with function you can call and I have this things…

Thanks for your help.

Can you share the script?

Your GameObject should be public.

Your Event should be calling a public method within the script.

When you hover your cursor over a marker, a tooltip displaying the function name and argument value appears. By hovering the mouse over an Animation Event marker, you can see the function it calls as well as the argument value.

I believe he is in the Animation Event Window; His issue is that he is unable to put anything into his Object field.

Also you mentioned your script contains the field Object gameObject. It should be GameObject gameObject, which is why I believe it is not working. The field you put is looking for an Object, while the particle effect you are trying to instantiate is a GameObject.

Hello, thanks for your respond. Today After restarting unity it’s fixed.
Unity event look like that :
8715918--1178235--upload_2023-1-9_9-52-38.png

this is my script for info :

public class StartAnimationScript : MonoBehaviour
{
    [SerializeField] private ParticleSystem ps;
    // Start is called before the first frame update
    public void StartParticuleSystem()
    {
        try
        {  
            ps.Play();
        }
        catch
        {
           
        }
    }
}

Now I have to work on the effect to match the movment of the animation.
Any tips about that? When I play this animation in this animator, the event and particule are not display. I have to play it in the scene to see the particule effect.

Thanks for your help.

I would store the position of where you want the particle to leave from, and then instantiate the particle at that position in a method. Then you can call the method on the AnimationEvent. Then after a certain time, destroy the particle.

Also, may you clarify for me, it plays in the scene view. Does it work in the game view and the ParticleSystem animator?