Hi,
I have two windows in my game (Start Window and Gameover Window) where the amount of collected points is shown using a simple textbox. That amount is always saved and loaded as Playerprefs.
However, this amount may be changed from different places: (1) during the game through collecting
(2) in the shop window through buying
(3) in the settings window through resetting (4)…
what is the best way to update the number in the textboxes of those two pages?
Right now I have to make two public variables (“Text textOnStartWindow” and “Text textOnGameoverWindow”) in every script where they get manipulated. But this shouldn’t be the most efficient solution right?
Is there a way like:
Script 1:
void CollectItem() {
items++;
collectedItemsText = items.ToString();
}
Script 2:
void PurchaseItem() {
items++;
collectedItemsText = items.ToString();
}