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;



    }
star

Thu May 06 2021 19:25:01 GMT+0000 (Coordinated Universal Time)

#c# #unity #plataformer

Save snippets that work with our extensions

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