- Home /
Why does this simple script not work?????
I try to accomplish : If Ipress a Key it should change the variable from true to false. and vic e versa.
pragma strict
var tst: boolean= true;
function Start () {
}
function Update () {
                     if (Input.GetKeyDown("i") && tst ==false)
                 {
                     tst= true;
                     print("true");
                 }
                     if (Input.GetKeyDown("i")&& tst ==true)
                 {
                     tst= false;
                     print("false");
                 }
}
So why does this script not work?????
               Comment
              
 
               
               Input.Get$$anonymous$$eyDown("i")
should be
 Input.Get$$anonymous$$eyDown($$anonymous$$eyCode.I)
Also format your code properly.
Your answer
 
 
             Follow this Question
Related Questions
Boolean while looking at a game object? 1 Answer
How do I switch a bool every two seconds? 3 Answers
How can I activate a scripts variable from another gameobject? 1 Answer
Problems with save 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                