Bump score at start of game

I noticed the same thing. At the start of each game I try, the score is automatically incremented to 1. After a little investigation I found that my player was touching the ground so that when the game started, it took the ground touching as a HIT! It is not set up as a collide object but scores it anyway. I SOLVED it by picking the player up and putting it just above the ground plane. BINGO! No more extra Hit score when starting the game.

This is just for information to anyone else that has the problem. I’m sure things like this will be address in future lectures and there are probably better ways of setting up a player character.


Thanks for this, It was driving me up the walls.

1 Like

I also had that but I did another thing.
If you don’t want to move the player up, you can disable the Mesh Collider on the ground plane. (But it will make the falling cube go through the ground later, so that’s a problem)

1 Like

I solved this by making int hits = -1; So now when the player hits the floor, the hits start at zero. There probably is a better solution though^^.


Pretty new to Unity development still, but you could probably use tags to fix this. Make the walls (or bumpable objects) have a tag and check if the object you are colliding into, has the tag.

Noticed the same thing and at first I thought I programmed it wrong, then I figured, the floor has the mesh collider too and fixed it easy. For now I just moved my player a little above the floor, but I would say using tags is a nicer fix.

You could also use collision layers to solve which objects are allowed to collide. That being said, with the player object’s Y-transform and all rotation frozen, a little bump above the ground is certainly the simplest solution atm.

Cheers for the fix! Glad it wasn’t just me having this issue haha.

Another method to fix this is by the following, this would also let you extend it to add jumping later and not increment with floor collisions:

    // Check if object is named Floor (or whatever you named the floor object in your scene)
    if (collision.gameObject.name == "Floor")
        Debug.Log("You've hit " + collision.collider + " this does not count to score!");
    // If it does not count it to score
        Debug.Log("You've hit " + collision.collider + " you hit something " + score + " times!");

I used this method, but i was really annoyed it would say you hit some thing 0 times when only the floor collision had happened, so this was my solution:

private int collisionCounter = -1;
private bool allowCounter = false;

private void OnCollisonEnter():

 if (allowCounter)
      Debug.Log("You've hit an object "  + collisionCounter + "times")

 allowCounter = true;


The boolean stops the display message the first time but allows it every other time. I didn’t want to raise the player over as I thought it was a less proper solution.