I have Game object I want to display it only one time if I have score < 2000 game object shown and if score > 2000 game object not shown , after that when score <2000 again game object not shown again (I assign game object as my image into inspector )
if (Scores < 2000) {
Rock1.gameObject.SetActive (true);
}
if (Scores > 2000) {
Rock1.gameObject.SetActive (false);
}
Simply use a boolean variable. You can use this code:
bool hideOneTime = false;
...
if (!hideOneTime)
{
if (score < 2000)
{
Rock1.gameObject.SetActive (true);
}
else if (score > 2000)
{
Rock1.gameObject.SetActive (false);
hideOneTime = true;
}
}
I hope it helps you