Waiting for GameObject to be destroyed before Instantiating the next one

I’m making a game similar to Fruit Ninja, but instead of swiping fruits, you have to click boxes.

I’m making the tutorial for the game and I want to throw a few boxes, one by one, freeze them into the air and show some info and let the player click them before spawning in the next one. I can’t seem to check if the previous box has been destroyed before Instantiating the next one. Tried a while loop and it just froze the entire editor. I tried by putting a CheckBox tag before an if check if the box is still on the scene and if the box was on the scene I would use go to to go back to the box tag and if not I would instantiate the next box and that also froze my Unity editor.

IEnumerator showTexts(float waitTime)
{
    Instantiate(welcomeText,welTextPos,Quaternion.identity);
    yield return new WaitForSeconds(waitTime);
    Instantiate(welcomeText2,welTextPos2, Quaternion.identity);
    yield return new WaitForSeconds(waitTime);
    Instantiate(firstBox);
    firstBoxInstance = GameObject.Find("TutorialWhiteBox(Clone)");
}

I tried using a coroutine because it allows WaitForSeconds function which I need so I can show text on screen for a limited time. From here I just want to spawn the next box to spawn after the first one has been destroyed.

Any help is appreciated. Thank you!

Hi,

Every MonoBehaviour will call the method OnDestroy() if implemented when the GameObject is being destroyed.
If you want to wait for a GameObject to be destroyed, you can simply raise an event inside the method OnDestroy() and bind what you want to do next to the event.
Does it answers to your question ?