Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Effective 2d Animation with Mecanim - Sample Code Inside

Discussion in 'Animation' started by JohnnyA, Jun 8, 2014.

  1. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Hi all,

    put together some scripts for a simple and effective animation controller for 2D sprites.

    Attached is:

    • PDF with a brief summary.
    • Unity package with code and a sample that extends the Unity 2D Platformer Sample.

    A similar script is used for the animations in the following videos:



    (Go to 6:50 to see some animations with overrides/priority :) )

    Code is MIT licensed (except Unity code for the sample which is asset store license), do with it what you will.

    I'll try to respond to questions.
     

    Attached Files:

    chelnok likes this.
  2. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Just a little bump :)
     
  3. ma.parizeau

    ma.parizeau

    Joined:
    Mar 21, 2010
    Posts:
    116
    Hi Johnny,

    This looks pretty cool. I just have one question or rather I would like to confirm something with you to make sure that I understand it properly.

    Take my situation where most of my animation can be played in a loop (idle, run) except for Jump, Shoot and HittingGround when falling.

    What I understand is that greater the priority is the more chances it will play in it's entirety? If not, with your script, how do I make sure that an animation plays completely before the next one in line plays?

    thanks,