Search Unity

Input problem

Discussion in 'Scripting' started by roka, Jan 31, 2015.

  1. roka

    roka

    Joined:
    Sep 12, 2010
    Posts:
    598
    Hello everybody,

    I work on my character movement in unity 5 and something strange happen.
    When i use the key "s" "q" "c" in the same time my code work but when i use "s" "d" "c", my code doesn't work.

    I have an azerty keyboard and i have try in qwerty and i got the same result.
    I have made a small code to test :

    Code (CSharp):
    1.         if(Input.GetKey("s")){
    2.        
    3.             if(Input.GetKey("q") && Input.GetKey("c")){
    4.            
    5.                 Debug.Log("S+Q+C");// work
    6.            
    7.             }else if(Input.GetKey("d") && Input.GetKey("c")){
    8.            
    9.                 Debug.Log("S+D+C");// not work
    10.            
    11.             }else{
    12.  
    13.                 Debug.Log("S");// work
    14.            
    15.             }
    16.  
    17.         }
    18.        
    19.         if(Input.GetKey("s") && Input.GetKey("d") && Input.GetKey("c")){
    20.        
    21.             Debug.Log("WORK");// not work
    22.        
    23.         }
    For me, "s" "d" "c" don't work when i press all keys. I have tested in Unity 4.x and Unity 5, same result.

    If someone can test or maybe know what happen.

    Have a good day.

    Thank You.
     
  2. roka

    roka

    Joined:
    Sep 12, 2010
    Posts:
    598
    Come on guy ^^ i'm sure that you have 5 minutes to test this code and i'm sure that we will find a bug from unity :)