Mechanim State Parameter Commands

Mechanim State Parameter Commands is a script that allows you to invoke a Parameter Command whenever a Mechanim state is entered, exited or when a certain percentage of its 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 play invoke Paramter Commands. 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 Parameter Commands" and add it.

 

 
The following controls appear in this script:
     
  1. Retrigger Parameter Commands Each Time Anim Loops w/o Exiting State
    •  
    • Retrigger When State Loops: Check this box if you want the timed animation sections to repeat invoking their Command every time the animation loops without exiting the animation state. If you had this checked, you could invoke a Command 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 Parameter Commands To Be Heard 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 receive the invoked Commands you configure here. For more detail, consult the Master Audio Multiplayer page.
     
  3. Enter Parameter Command
    •  
    • Invoke Parameter Command: Check this to invoke a Parameter Command when the state is entered.
    •  
    • Enter Parameter Command: Select a Parameter Command to invoke for when the state is entered.
     
  4. Exit Parameter Command
    •  
    • Invoke Parameter Command: Check this to invoke a Parameter Command when the state is exited.
    •  
    • Exit Parameter Command: Select a Parameter Command to invoke for when the state is exited.
     
  5. Invoke Parameter Command Timed To Animation
    •  
    • Invoke Anim Time Parameter Command: Check this to invoke a Parameter Command when a certain percentage of the animation is completed.
    •  
       
    • When To Invoke Parameter Command: Here you specify the percentage of the animation that must be complete for the Parameter Command to be invoked. Value is between 0 and 1, with .5 meaning 50%.
    •  
    • Timed Parameter Command: Select a Parameter Command to invoke at the point that X% of the animation is completed.
     
  6. Invoke Multiple Parameter Commands Timed To Anim
    •  
    • Invoke Multi Anim Time Command: Check this to invoke a Parameter Command when a multiple different percentages of the animation are completed (up to 4).
    •  
    • Num Of Multi Commands To Invoke: Specify where to use 0-4 of the "When To Start" percentages below.
    •  
    • When To Invoke Multi Command 1: Here you specify the percentage of the animation that must be complete for the Parameter Command to be invoked. Value is between 0 and 1, with .5 meaning 50%.
    •  
    • When To Invoke Multi Command 2: Here you specify the percentage of the animation that must be complete for the Parameter Command to be invoked. Value is between 0 and 1, with .5 meaning 50%.
    •  
    • When To Invoke Multi Command 3: Here you specify the percentage of the animation that must be complete for the Parameter Command to be invoked. Value is between 0 and 1, with .5 meaning 50%.
    •  
    • When To Invoke Multi Command 4: Here you specify the percentage of the animation that must be complete for the Parameter Command to be invoked. Value is between 0 and 1, with .5 meaning 50%.
    •  
    • Multi Timed Parameter Command: Select a Parameter Command to invoke at the point that X% of the animation is completed.