Unity2D Destroy doesn't get rid of game objects,Gameobject Destroy not destroying object
In my game, I have balloons appear on the screen (they are instantiated). I want all of the balloons on the screen to be destroyed to then spawn new ones.
public void resetBalloons(){
tempBalloons = GameObject.FindGameObjectsWithTag("Balloon");
foreach(GameObject ballon in tempBalloons){
Destroy(balloon);
}
...
This is the code that is meant to destroy the balloons, but for whatever reason, all of the balloons remain. I have confirmed that the function is being called the correct amount of times through Debug.Log() calls, so the function is running, and the FindGameObjectsWithTag is finding the balloons too. Just for whatever reason, it is ignoring the Destroy function.
Destroy() will destroy the objects before the next frame, they will remain during the current frame and FindGameObjectsWithTag() will still find them. Are they still there the next frame?
Your answer
Follow this Question
Related Questions
2D Android Game Rapid Jumping Problem,Unity 2018.2.9f1 Android 2d Speed Jumping 0 Answers
destroying instantiated groups of objects 1 Answer
SetActive is destroying objects instead of settings them as false 0 Answers
How to make -Count down Timer on entrance and exit triggers and display remaining time 0 Answers