Search Unity

Hello chaps! I require some form of help!

Discussion in 'Animation' started by 01leirbag, Apr 1, 2014.

  1. 01leirbag

    01leirbag

    Joined:
    Mar 30, 2014
    Posts:
    1
    Please i want to do an animation with a gun but give me an error. What i do?
    This is the script



    animation.wrapMode = WrapMode.Once;

    }

    function Update () {

    if.Input.GetButtonDown("Fire2"){
    animation.Play("Mira");
    }

    if.Input.GetButtonUp("Fire2"){
    animation.Play("Mira_back");
    }

    }
    }
     

    Attached Files:

  2. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    26,096
    Had to rename thread title to the current from "Whai i do????????????????" which was even less clear. I hope this lateral movement in clarity assists in your quest for aid.
     
  3. wolfhunter777

    wolfhunter777

    Joined:
    Nov 3, 2011
    Posts:
    531
    You need to put the conditions in the if-statement inside brackets, not use a period.
     
  4. christides11

    christides11

    Joined:
    May 19, 2012
    Posts:
    667
    First, you should probably give the error your getting.
    But I'm guessing because you formatted wrong. Looks like you don't know much of coding from what I see.
    http://unity3d.com/learn/tutorials/modules/beginner/scripting

    Code (csharp):
    1.  
    2. function Start(){
    3.     animation.wrapMode = WrapMode.Once;
    4. }
    5.  
    6. function Update () {
    7.  
    8.     if(Input.GetButtonDown("Fire2")){
    9.         animation.Play("Mira");
    10.     }
    11.  
    12.     if(Input.GetButtonUp("Fire2")){
    13.         animation.Play("Mira_back");
    14.     }
    15.  
    16. }
    17.  
     
unityunity