[Unity] Basic Inputs

Keyboard/Controller Inputs

  • GetButtonDown
    //TBD
  • GetAxis, GetAxisRaw
    ex)  //one time press, not continuous 
    public RectTransform myCurser;
    Vector3 myOffset = new Vector3(200, 0, 0);
    bool inUseFlag = false;
    void Update()
    {
     if(Input.GetAxisRaw(“Horizontal”) != 0)
      {
        if(!inUseFlag)
        {
          myCurser.localPosition += Input.GetAxisRaw(“Horizontal”) * myOffset;
          inUseFlag = true;
        }
      }
      else
      {
        inUseFlag = false;
      }
    }

Touch Inputs

Scroll to Top