WER
CTRL + D复制
双击左边 和 F 以选中物体为中心显示
clobal local
y轴 up
z轴 forward
x轴 right
transform
void Start()
{
Debug.Log("开始测试");
GameObject obj = this.gameObject;
string name = obj.name;
Debug.Log("物体名称:" + this.gameObject.name);
Transform tr = this.gameObject.transform;
Vector3 pos = this.gameObject.transform.position;
Debug.Log("物体位置:" + pos.ToString("f3"));
obj.transform.position = new Vector3(0, 0, 0);
obj.transform.localPosition = new Vector3(0, 0, 0);
Application.targetFrameRate = 60;//尽量以60来更新帧率
}
void Update() // 更新游戏状态
{
Debug.Log("upate:" + Time.time);
Debug.Log("upate:" + Time.deltaTime);//与上一次的时间间隔
//使用deltaTime 让物体匀速运动
float speed = 1;
float distance = speed * Time.deltaTime;
//让物体运动
Vector3 pos = this.transform.localPosition;
pos.x -= distance; //0.1f;
this.transform.localPosition = pos;
}