Score/Resource Counter

I’m a beginner game maker and I’ve made part of a game. I have it so that when a player clicks on a certain item, It disappears. I need to make it so that when the player does this, a number in the top right goes up by 1. If someone could help that would be good. If you need a example of my code I could put it up. Thanks!

I am not entirely sure what you mean by “disappears”, so I am going to assume that you’re either disabling or destroying the object in question.

Assuming you either have an object reference to the scoreboard MonoBehaviour in the code or have a static reference, you could simply make the value public and alter it in one of two ways depending on if you are disabling it or destroying it.

If you are simply disabling it:

void OnDisable()
{
    ScoreBoard.Value++;
    ScoreBoard.TextCounter.text = ScoreBoard.Value; //this assigns the number to the text of your UI text box.
}

If you are actually destroying it:

void OnDestroy()
{
    ScoreBoard.Value++;
    ScoreBoard.TextCounter.text = ScoreBoard.Value;
}

This would need to live on the object that is disappearing.

Hope this helps!