Mechanim State Custom Events

Mechanim State Custom Events is a script that allows you to fire Custom Events whenever a Mechanim state is entered, exited or a certain percentage of the animation is completed. While Event Sounds can do the state entered part, the code is not event-driven, so less efficient although Event Sounds can do a lot more than just fire Custom Events. To add it, click the "Add Behavior" button on the Inspector pane after you click on a Mechanim state from the Animator window, find "Mechanim State Custom Events" and add it.

 

 
The following controls appear in this script:
     
  1. Retrigger Events Each Time Anim Loops w/o Exiting State
    •  
    • Retrigger When State Loops: Check this box if you want the timed animation sections to repeat firing their Custom Events every time the animation loops without exiting the animation state. If you had this checked, you could fire a Custom Event timed to play when 29% of the animation was complete, all 3 times the animation looped instead of only the first time.
     
  2. Select For Events To Be Received By All Connected Players
    •  
    • Multiplayer Broadcast: This checkbox only appears if you have enabled Multiplayer Capability on the Welcome Window and will make sure that all players in your multiplayer game hear the sounds you configure here. For more detail, consult the Master Audio Multiplayer page.
     
  3. Enter Custom Event
    •  
    • Fire Enter Event: Check this to fire a Custom Event when the state is entered.
    •  
    • Enter Custom Event: Select a Custom Event to fire for when the state is entered.
     
  4. Exit Custom Event
    •  
    • Fire Exit Event: Check this to fire a Custom Event when the state is exited.
    •  
    • Exit Custom Event: Select a Custom Event to fire for when the state is exited.
     
  5. Fire Custom Event Timed To Animation
    •  
    • Fire Anim Time Event: Check this to fire a Custom Event when a certain percentage of the animation is completed.
    •  
    • When To Fire Event: Here you specify the percentage of the animation that must be complete for the event to be fired. Value is between 0 and 1, with .5 meaning 50%.
    •  
    • Timed Custom Event: Select a Custom Event to fire at the point that X% of the animation is completed.
     
  6. Fire Multiple Custom Events Timed To Anim
    •  
    • Fire Multi Anim Timed Events: Check this to fire a Custom Event when a multiple different percentages of the animation are completed (up to 4).
    •  
    • Num Of Multi EventsTo Fire: Specify where to use 0-4 of the "When To Start" percentages below.
    •  
    • When To Fire Multi Event 1: Here you specify the percentage of the animation that must be complete for the event to fire. Value is between 0 and 1, with .5 meaning 50%.
    •  
    • When To Fire Multi Event 2: Here you specify the percentage of the animation that must be complete for the event to fire. Value is between 0 and 1, with .5 meaning 50%.
    •  
    • When To Fire Multi Event 3: Here you specify the percentage of the animation that must be complete for the event to fire. Value is between 0 and 1, with .5 meaning 50%.
    •  
    • When To Fire Multi Event 4: Here you specify the percentage of the animation that must be complete for the event to fire. Value is between 0 and 1, with .5 meaning 50%.
    •  
    • Multi Timed Event: Select a Custom Event to fire at the point that X% of the animation is completed.