I started trying to code in unity and followed Muddy Wolf Games tutorial, and I had to made some sort of script I think. As I am pretty new to this once I got an error I had no idea how to fix it.
is the tutorial and my code looks like this.
public class PlayerMovement : MonoBehaviour
{
public float movementSpeed;
public Rigidbody2D rb;
Additionally, copy and paste the complete error message (do not try to summarize the error message yourself) as it includes the line the error was on.
Vector2 movement = new Vector2(mx * movementSpeed, rb,velocity.y);
You have accidentally placed a comma instead of a period between “rb” and “velocity”. It should be:
Vector2 movement = new Vector2(mx * movementSpeed, rb.velocity.y);
Remember, if you get a compile error while following a tutorial, go to the line with the error and pay extremely close attention to every letter and symbol used in the tutorial. A , instead of a . or a : instead of a ; can be the difference between a perfectly functional script and a project that won’t compile at all.