📜  unity 2d 操纵杆控件 - C# 代码示例

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

代码示例1
public Joystick joystick;

private Vector3 input;
public float Speed = 5f;

private void Update()
    {
        input = new Vector3(joystick.Horizontal, joystick.Vertical);
        Vector3 velocity = input.normalized * Speed;
        transform.position += velocity * Time.deltaTime;
    }