Dropper Object counts a hit on pressing play

Having a bit of trouble figuring out why my Dropper object counts a hit upon pressing play.

When I press play, the Dropper tells the console log that “you’ve bumped into a thing this many times: 1”. It doesn’t change colour however; that still waits for the Player object to bump it before doing so.

I’m certain it’s the Dropper and not the fact the Player object is touching the Plane because: I had already fixed the problem with the Plane object triggering a hit because of the Player object was touching it; and when I do hit the Dropper object, it changes colour but does not increase the score, which suggests the message that is sent upon pressing play is coming from the Dropper.

I have also checked to see if the tag on the Dropper changes to Hit too early, but it does not, and I’ve looked through some other posts under the lecture but haven’t managed to figure the problem from them.

Any ideas?

Hi,

Have you already tried to add Debug.Logs to your code to see what is going on during runtime?

It could well be that the player collides with the ground when you press the Play button. Maybe the ground needs its own tag which you could filter out with an if-statement.

1 Like

It looks like my player was still touching the ground and that was what was triggering the score upon pressing play. I thought I’d already fixed it previously so completely overlooked it - it shows sometimes the simplest solution is the right one!

Still couldn’t figure out why the Dropper object wasn’t increasing the score despite having the right scripts in it, so I deleted it and created a new one and now it works fine.

2 Likes

Good job on fixing the problem. :slight_smile:

Sometimes, if you cannot find an issue, removing components from a game object and adding them again solves certain issues.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms