4方向だけの動作を組んでいるのですが、
斜め入力(同時押しの時)に優先順位が右、左、上、下の順の処理になってしまいます。
例えば右に入力中に右上入力されたら上を優先するみたいなことがやりたいです。
最後に押された方向キーを優先して処理するにはどうすればいいでしょうか?

public class test : MonoBehaviour
{
Vector2 pos;
// Start is called before the first frame update
void Start()
{
pos = transform.position;
}

// Update is called once per frame
void Update()
{
if (Input.GetKey("right")){ pos.x += 0.1f;}
else if (Input.GetKey("left")){pos.x -= 0.1f;}
else if (Input.GetKey("up")){pos.y += 0.1f;}
else if(Input.GetKey("down")){pos.y -= 0.1f;}
transform.position = pos;
}
}