texture.width >> 1和(texture.height >>是右移一位,相当于除以2。(x >> 1) 和 (x / 2) 的结果是一样的。

void OnGUI()

  {

  //绘制准心

  Rect  rect = new Rect(Input.mousePosition.x - (texture.width >> 1),Screen.height - Input.mousePosition.y - (texture.height >> 1),texture.width, texture.height);

  GUI.DrawTexture(rect, texture);

  }