Snippets Collections
    public float movementSpeed;

    public Rigidbody2D rb;



    float mx;



    private void Update()
    {

        mx = Input.GetAxisRaw("Horizontal");

    }



    private void FixedUpdate()
    {

        Vector2 movement = new Vector2(mx * movementSpeed, rb.velocity.y);



        rb.velocity = movement;



    }

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension