Need help resolving this error

(29,27): error CS1002: ; expected

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

public class GroundCheck : MonoBehaviour {

void Start()
{

}

void Update()
{

}
private int countColliders = 0;

private void OnCollisionEnter(Collision collision) {
countColliders++;
}

private void OnCollisionExit(Collision collision) {
countColliders--;
}

private void IsGrounded() {
return countColliders 0;
}

}

I tried to fix it but if i try to it gives me more errors, no articles online have helped either

Private void IsGrounded() , being a void function, should not return anything. Make that line

countColliders = 0;

2 Likes

Please note for the future that the 2D forums are not for fixing general scripting errors. If you have a script issue then please post in the scripting forum. Your post isn’t even related to 2D TBH (it’s 3D physics).

Finally, note that you post the error and line number but you don’t use code-tags so the line isn’t obvious. In your case the error is obvious though and thankfully someone above helped you correctly. :slight_smile:

1 Like