Question by
DarkFang100 · Jul 01, 2020 at 07:20 PM ·
c#2dscript.leaderboardscoreboard
How to have a scoreboard system through multiple objects?
This might be a very specific case, but here goes. I have a script on 16 different ball objects in a 2D Unity Project. The script basically says that when one ball gets smaller than a certain size (Hitting another ball causes the ball to get smaller and hitting certain walls causes the ball to get bigger), the ball will die. I want to implement a scoreboard system onto this script but I don't know how to update the Placement variable globally throughout all of the scripts, and this is because of this piece of code:
if (xSize <= 0.1f && ySize <= 0.1f)
{
ballPlace -= 1.0f;
print(name + " Has finished in " + ballPlace + "th place.");
gameObject.SetActive(false);
}
Which sits in void Update(). How can I make it so that the variable updates globally throughout all 16 balls? Thank you for any help :D.
Comment