Hello! I have recently started to make a 2D platformer in Unity, and although I have followed several tutorials with different methods, I have came up with the same result continuously - not working. I am using Microsoft's Visual Studio Code. Here is my script -
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour {
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;
Apparently the code it working for other people, and it should be producing this -
![](https://uploads.gamedev.net/forums/monthly_2021_08/6f91aded817547199387e2b8e3e97be4.Screenshot-2021-08-14-103622.png)
But I am receiving this -
![](https://uploads.gamedev.net/forums/monthly_2021_08/90971d44aae344e69da377cebca4e789.image.png)
I am sure it is something stupid that I am not doing right, but please help. Thanks in advance!