Obstacle Course - Scoring - Player Counts Ground

As many people have likely experienced already, if you use a simple shape with collider as your character and keep it slightly above the ground when the game begins it’ll fall to the ground and count as 1 score.

To solve this problem, I revisited the “Scorer” script and used an if statement with a CompareTag method to check to see if the collider the player was hitting did not have a “Ground” tag.

So I went into my object hierarchy, gave my “Ground” a “Ground” tag, and gave my walls a “Wall” tag. Then I wrote:

if(!collision.collider.CompareTag(“Ground”)) {

Debug.Log(“Your statement here” + hits);


Now when the player falls to the ground, it doesn’t increment because it will only increment if it collides with a collider not tagged with “Ground”.

Privacy & Terms