Search Unity

Bug Input.GetAxis("Mouse X") not work on playing but work after building

Discussion in 'Linux' started by t_w, Sep 9, 2015.

  1. t_w

    t_w

    Joined:
    Aug 4, 2015
    Posts:
    55
    Code (CSharp):
    1.         if (Input.GetMouseButton(1)){
    2.            
    3.             Debug.Log("Right Mouse Button");
    4.            
    5.             this.transform.Rotate(new Vector3(0f,-Input.GetAxis("Mouse X"),0f).normalized
    6.                                            *rotateSpeed,Space.Self);
    7.             Debug.Log(Input.GetAxis("Mouse X"));
    8.  
    9.         }
    When I click play, Debug will show like the below
    Code (CSharp):
    1.   Debug.Log("Right Mouse Button");  //give me the infomation. But
    2.   Debug.Log(Input.GetAxis("Mouse X"));   //always give me 0
    But when I build the game, and run, it worked, object rotate well.
     
  2. Zuntatos

    Zuntatos

    Joined:
    Nov 18, 2012
    Posts:
    612
  3. t_w

    t_w

    Joined:
    Aug 4, 2015
    Posts:
    55