整数结果整体偏移1方法--取整计算原值一半
GUI.DrawTexture(new Rect((Screen.width - Imagetexture.width) >>1, 10, 120, 120), Imagetexture);
假设(Screen.width - Imagetexture.width)是300 二进制为 100101100
向右移动一位 为 10010110 计算之后 正好是150 是原来一半
结果不用判断奇偶,如果(Screen.width - Imagetexture.width)为奇数,则结果 为减1除以2

浙公网安备 33010602011771号