Unity getting the score

Hello my problem is I have a lot of game object and theres a same script on it.

there’s a int variable on every game object . but every time I do this … count +=5;

the only output is 5 its never increasing … I know its because its all the same script on each object … I wanna know a way to increase it

I tried Playerprefs but no luck

The score should be on a single gameobject… Call it “ScoreKeeper”.

Once you want to add the score… say from your smaller objects, you could do:

GameObject.Find(“ScoreKeeper”).GetComponent().MyScore += 5;

That is one example of doing it. You’d ideally want to set your score keeper as a singleton, so you don’t have to continuously use GameObject.Find.