Error in code

I am getting this error. Can somebody can help me ?

Did you make a IncrementScore?

to less to be serious here.

because Script is "mono"
so you do an Assignment ( sorry me german ) that is not define here.

“IncrementScore” = i think an other Script, no Define here ( i only noob in this cases, but
i think, you use a not defined value )

ScoreKeeper scoreKeep = FindObjectOfTypey(); <- seems to be okay.
Scorekeeper.IncrementScore(scorePerHit); <- is not okay.

just watch your Public Classes.
There is only Definition for "public int scorePerHit = 1;

there is inside MomoBehaviour no Parameter called: “IncrementScore”

So in my Opinion:
you need :

Class DetectScorcing : ?? ( maybe ScoreKeeper? - not MonoBeheaver ? )

or you have a Argument that not can be intapolated, like: “incrementScore” this is not known
in this MonoBehaviour ( i am sorry, i am new at this, if i do some mistakes, please tell me.
i am not “profi” in this Case, but i think, this can be the Mistake.

Hi the reason why you get this error it’s because you are searching the method of the class ScoreKeeper instead of the instance scoreKeep.

You have just to change ScoreKeeper.IncrementScore to scoreKeep.IncrementScore

Thank you TheNightFlier and SimonSP. Its working now. Its kinda silly error. Anyways thank you for looking into it.

1 Like

Don’t worry.
When you don’t want what to do ask in the community.

Privacy & Terms