Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Cant seem to get Mecanim Events to work.

Discussion in 'Animation' started by Purpleshine84, Apr 5, 2014.

  1. Purpleshine84


    Apr 8, 2013
    I cant find any descent tutorial or documentation on how to script events from an animationclip. I am talking about Mecanim here (not about the Legacy system). Please, if someone could give me an example that would be great.
  2. jtdev


    Apr 13, 2014
    In the animation clip import inspector, go to the Events (bottom one) and add an Event for the time you (use the Play and Scrub controls there in the preview window below it). Make sure you are adding it right, the little buttons there to add an Event are not intuitive. And fill in the function name field, you'll need it later for the code.

    Then, in the component on an object running that clip, add a function named the same as the name you gave it when you created the Event above.

    It uses SendMessage to call your function delegate.