Please Help Me TO CORRECT MY SCRIPT

Hey so I’ve been trying to make a 2D game and wanted to correct multiple jumps. My script appears to have an error CS1003: Syntax error,‘,’. So heres the script and if someone knows please help me!

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : MonoBehaviour {
public float movementSpeed;
public Rigidbody2D rb;

public float jumpForce = 20f;
public Transform feet;
public LayerMask groundLayers;

float mx;

private void Update() {
mx = Input.GetAxisRaw(“Horizontal”);

if (Input.GetButtonDown(“Jump”) && isGrounded()) {
Jump();
}
}

private void FixedUpdate() {
Vector2 movement = new Vector2(mx * movementSpeed, rb.velocity.y);

rb.velocity = movement;
}

void Jump() {
Vector2 movement = new Vector2(rb.velocity.x, jumpForce);

rb.velocity = movement;
}

public bool isGrounded() {
Collider2D groundCheck = Physics2D.OverlapCircle(feet.position, o.5f, Groundlayers);

if (groundCheck. != null) {
return true;
}

return false;
}
}
That was it so if you know how to correct it please anweser!

How to understand compiler and other errors and even fix them yourself:

https://discussions.unity.com/t/824586/8

Remember: NOBODY memorizes error codes. The error code is absolutely the least useful part of the error. It serves no purpose at all. Forget the error code. Put it out of your mind.

The important parts of an error message are:

  • the description of the error itself (google this; you are NEVER the first one!)
  • the file it occurred in (critical!)
  • the line number and character position (the two numbers in parentheses)

All of that information is in the actual error message and you must pay attention to it. Learn how to identify it instantly so you don’t have to stop your progress and fiddle around with the forum.

ALSO, if you post a code snippet, ALWAYS USE CODE TAGS:

How to use code tags: https://discussions.unity.com/t/481379

Also, consider this:

2 Likes

Use code tags, otherwise your code is harder to read and spot issues with. Also copy and paste the whole error message, because you’ve missed some information that is important (in this case, line numbers).

There does seem to be a stray period in your groundCheck if statement, though. (I’d give you a line number if you’d used code tags)

2 Likes

It also looks like you are using an o instead of 0 in your OverlapCircle line:
o.5f should be 0.5f
I can’t tell you the line number either as you didn’t use code tags. You also did not include the whole error message as you missed off the most important bit which tells us the line number (although that would also require that you use code tags when posting so we can match up the error to the line).
If you are using an IDE (like Visual Studio) it should be showing you where the error is anyway as it will underline incorrect code. If you are not using an IDE, then I think now is the time to start.

2 Likes