public float Speed = 5f;
public Rigidbody2D rb;
public Vector2 movement;
void Update()
{
movement = new Vector2(Input.GetAxisRaw("Horizontal")
}
private void FixedUpdate()
{
rb.MovePosition(rb.position + movement * Speed * Time.fixedDeltaTime);
}
(без вирусов).