📜  基本动作脚本 unity - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:04.241000             🧑  作者: Mango

代码示例3
public float speed = 5;

void Update() {
    float x = Input.GetAxisRaw("Horizontal");
    float y = Input.GetAxisRaw("Vertical");     
    gameObject.transform.Translate(new Vector3(x,y,0) * speed * Time.deltaTime);
}