Children Overproducing

In a predicament.

Ol gameObject 1 and gameObject 2 have been getting together on the weekends and giving me spawns. They dont stop!

Now i have too many.

What can i do. The buggers are everywhere.
In a way i guess i want to abort all future children from being instantiated under an object once i reach a nice number like 24. What script functions should i use to achieve this?

Thanks for the help.

Not sure what language you want the code in, but you basically need to count the number of items that are contained in the parent’s transform.

  import System.Linq
...
parentObject.transform.Cast.<Transform>().Count();

Would do it in UnityScript