Search Unity

Mecanim Random Animations

Discussion in 'Animation' started by CDF, Oct 31, 2013.

  1. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,311
    Hi, trying to figure out how to play random animations in mecanim.

    Say I had 60 animations and wanted to transition from animation 56 to animation 3. How could I do that through code?

    It looks as if I would need to create 60 in/out transitions for every animation to every other animation and use an integer property to control the animation. But that's not practical.

    would be nice if I could just play an animation directly. Something like: animator.Play("RandomAnimation3")
     
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,688
    What about 60 transitions from Any State, one to each random animation? It's still a lot of transitions, but at least not 60*60.
     
    theANMATOR2b likes this.
  3. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,311
    ah that could work. Thanks