how to limit the amount of children that are in a parent in unity
int childMax = 1;
 
    void Update()
    {
        childMax = transform.childCount;
       
        for (int chCnt = 1; chCnt > childMax; chCnt--)
        {
            transform.DetachChildren();
        }
 
        Debug.Log (childMax);
    }
