Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Mecanim Mobile Animation

Discussion in 'Animation' started by alarm656, May 8, 2014.

  1. alarm656

    alarm656

    Joined:
    Jul 6, 2013
    Posts:
    111
    Please can someone teach me how to animate hand and weapon with mecanim in mobile. I have set all animations (Shooting, MeleeAction, GrenadeThrow, Reload)in Animator. Made all animations boolean (true/false). Everything is ok Animations works if I click booleans in Animator window. I want to animate them by pressing GUI buttons. I have GUI buttons like Joystick for each animations. But I have no idea how to animate them by pressing the buttons. Because I don't know coding(((. All mecanim tutorials only for PC:(. Thank you in advance.
     
  2. jRocket

    jRocket

    Joined:
    Jul 12, 2012
    Posts:
    699
    You have to do it in code. It will look something like the following-

    Code (csharp):
    1.  
    2. if (GUI.Button(Rect(10,10,50,50), "mybutton")){
    3.        Animator.SetBool("animationname", true);
    4. }
    5.  
     
  3. alarm656

    alarm656

    Joined:
    Jul 6, 2013
    Posts:
    111
    Thank you jRocket:)