Score System

I am now able to spawn my object and destroy them each with a single click, or rather a single tap since this game is being developed for android. The only things left of my game are inserting the scoring system and creating the Game Over trigger. I’m rather stuck on the Scoring System.

Does anyone have an example script?

When I do create my own script, do I attach the scoring script into the Main Camera or the GameObject?

(Also, I just want the numbers to appear. How do I do that? I do not want this for example: "Score: 200:.)

the score should just be an int or a float that changes when you do something that changes the score.

for the text: make a GUIText and then you can do guitext.text = "Score: " + score

It doesnt really matter where you put the script, aslong as it’s in your scene and not being destroyed anywhere in the scene.

Example:

private int score;

private bool playerHit;

void Awake (){
score = 0;
}

void Update(){
if (playerHit){
score += 20;
}


void OnTriggerEnter2D OR something else() {
playerHit = true;
}

}

is this what you want? ;p

You can just make the GUIText be equal to the score variable ;p