解决方法很多!if(Input.GetKey(KeyCode.D)){this.transform.localRotation.y=90;}这句话是否写在OnGUI方法里面去了,如果是,请写回Update方法中。没有的话,就改变一下transform.Rotation(Vector3.up*90)