Start out with a hit

Hi again i got this little problem where my game starts out with a hit. There is no walls nearby yet
i have followed exactly to the point
How come that i don’t get the exact same outcome when i typed it exactly like Rick have.
(Im a beginner so i don’t even know what the colors mean and why it’s changing and don’t know if i missed it in a earlier video)


No i got another problem after i saved it so it would compile in unity this i cannot see how to fix since i don’t know what it’s asking me to do

Hi Thomas,

I had the same problem regarding the “Instant Hit” at the start of the game. I believe this is due to clipping on the Plane beneath the player, so if you lift your player slightly higher up it should resolve the issue.

Hi Thomas,

The two error messages your seeing are saying the Scorer class (which is within the Scorer script from the tutorial) has been defined twice in your project.
Check the scripts you have created and make sure the following code only appears once :

public class Scorer : MonoBehaviour
{
    int hits = 0;

    private void OnCollisionEnter(Collision collision)
    {
        hits++;
        Debug.Log("You've bumped into a thing this many times: " + hits);
    }
}

Hope this helps :slight_smile:

Hi Orangeoz thanks for the reply. I have now tried to double check my code but it seems like it totaly identical to the picture you have sent :neutral_face: i checked my dropper code and it seems like they look alot like and thought that they might be creating the problems. They both got the whole OnCollision but i do not know at all.


Hi David
I can’t wait till i can test it but i have a bigger problem that makes me unable to playtest right now, i can’t seem to fix at all and hope for a solution soon :grinning:

1 Like

Okay the message really makes it sound like there’s two definitions for Scorer.

Since your using Visual Studio Code it would be worth opening all the scripts in your project then doing a search for the word “Scorer”. It will list everywhere the class is used, if the issue is with the scripts, more than one .cs file will show up in the list. For example, I have defined the class both in Scorer.cs and in Test.cs, so its listed both (you can ignore the UnityTempFile entries). Just want to make sure there’s not a duplicate definition hiding anywhere.

If only one .cs file is listed then it could be that a package you have imported includes a definition with the name Scorer, but since the tutorial doesn’t import any package other than Cinemachine, I think this is unlikely.

Let me know how you get on :slight_smile:

Thank you for the help i found out after i put the scripts into the folders it apparently created a second scorer file so i had 2 (i do not know why it did it) Many thank you now i can continue with the course :smile: now i just have this little start bump when i start my project but i think i can live with that for now i have Tried David_Millers idea but as soon as it hit’s the floor it says it got a hit

1 Like

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