public static void DestroyObjectWithAllParents(Transform child) { Transform parent = child; while (parent.parent) { parent = parent.parent; } GameObject.Destroy(parent.gameObject); }