- Home /
 
 
               Question by 
               uberdood12 · Sep 17, 2011 at 05:53 PM · 
                animation  
              
 
              Way to have mulitple input?
Hello I was wondering if there is a simple way to have multiple input.
For example: I would like it so that when I hit the w key and the left shift key an animation plays.
 function Update () {
 if (Input.GetKey(" w + left shift"))
 animation.Play("My animation");
 }
 
               I know this script is wrong just want to give you an idea of what I would like.
Thanks in advance for any help!
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by asafsitner · Sep 17, 2011 at 06:02 PM
Your logic is good, but your syntax is incorrect :)
 if (Input.GetKey("w") && Input.GetKey("left shift"))
     animation.Play("My animation");
 
               Or, if you want either key to play the animation use logical OR operator:
 if (Input.GetKey("w") || Input.GetKey("left shift"))
     animation.Play("My animation");
 
              Your answer
 
             Follow this Question
Related Questions
Animation / Distance 0 Answers
how to get a animation from other script on colision 1 Answer
How to call animation from another Script in C#? 1 Answer
enemy shoots with animation 1 Answer
How to click a 3d object in unity3d? 3 Answers