HI!
I have a code:
[SerializeField] public GameObject[] objectToDestroy = new GameObject[3]; // 3 Buttons (This my Category)
[SerializeField] public GameObject nextLevelButton; // button change level, Scene
public void DestroyGameObject1() //onclick first button Destroy this Button
{
Destroy(objectToDestroy[0]);
}
public void DestroyGameObject2() //onclick second button Destroy this Button
{
Destroy(objectToDestroy[1]);
}
public void DestroyGameObject3() //onclick third button Destroy this Button
{
Destroy(objectToDestroy[2]);
}
I want how many Button are left in objectToDestroy array? If all buttons destroy - start code
I made code:
if (objectToDestroy.Length < 1) //No Error, no count
{
print("All Buttons Destroy");
}
Where error?