Search Unity

how to add an attack to mecanim

Discussion in 'Scripting' started by ultimateronsu17, Aug 28, 2015.

  1. ultimateronsu17

    ultimateronsu17

    Joined:
    May 30, 2015
    Posts:
    34
    Hey guys I have a question how many ways do I have to add an attack to mecanim I have 3 attack animations and just wondering in script do I use a trigger or are there other ways Thanks if anyone replies :)
     
  2. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437
    Have you looked at using animation "Events" within mecanim. You can call functions at specific points in the attack animation's time length. Each individual animation within your import settings should have an "Event" option. But you have to setup an animation controller for your character(s) that uses those animations (i.e. plays them when certain conditions are true or not).

    You can use triggers as well to detect collisions, but I personally find using events much easier and cleaner. Unless you're talking about how to get those animations onto your character?