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

animation help

Discussion in 'Scripting' started by Mr.badatscripting, Dec 5, 2010.

  1. Mr.badatscripting

    Mr.badatscripting

    Joined:
    Jul 1, 2010
    Posts:
    132
    ok i am making a connect 4 game and want to press c to start an animation that moves the bar thing at the bottom of the bored that releases the chips. can anyone help. this is what i got so far.

    function Update(){

    if(Input.GetButtonUp("c"))
    {
    and have a script in here that starts the animation
    }
    }
     
  2. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    Assuming you've got an animation for the bar opening, the code in the "if" statement could be as simple as:-
    Code (csharp):
    1. animation.Play();
    If you've got more than one animation for the object, you will need to pass the name of the one you want to play as a parameter.