Unity3dC#脚本实现点击物体旋转usingUnityEngine;usingSystem.Collections;publicclassroated:MonoBehaviour{privateboolroate;privatefloatRoatedSpeed=1000.0F;voidStart(){roate=false;}//UpdateiscalledonceperframevoidUpdate(){if(Input.GetMouseButton(0)){floaty=0;y=Input.GetAxis(MouseX)*RoatedSpeed*Time.deltaTime;if(roate){gameObject.transform.Rotate(newVector3(0,y,0));}}}voidOnMouseDown(){roate=true;Debug.Log(collider);}voidOnMouseUp(){roate=false;Debug.Log(Outofcollider);}}