I’m a novice programmer and I’m currently taking class for C#. The first thing I learned at my school is the consent looking for information and trying to learn something new within programming everyday. This month unfortunately is a class that does not involve programming at all. So i took it upon myself to try to clone old retro games in hopes for understanding how to break them down piece by piece to be able to fully replicate them. For my first project I decided to clone galaga. I’ve managed on my own to get movement, firing the laser and basic enemy collision to work. But i’m having issues with enemy spawning. For the time being I want to just get formations spawning after one formation has been destroyed. Once I get different formations spawning after the previous has been destroyed i can start to call a random formation. My formations are set up with an empty as the parent and a bunch of enemies as the children.This is just prototyping the spawning i’m not looking for loops into formations or actual galaga spawning. All i’m currently looking for is how to destroy the parent after all the children have been destroyed. I have attached a photo of what the hierarchy looks like with the formation.
If I understand your question correctly, when a child dies, you could check their transform.parent.childCount.
If you do this in OnDestroy, and the childCount is 1, you know it’s the last child and can destroy the parent.