using System;
using System.Collections.Generic;
using UnityEngine;

public static class GetAllSubGameObject
{
    public static List<GameObject> GetAllChildren(this GameObject gm)
    {
        List<GameObject> objects = new List<GameObject>();
        for (int i = 0; i < gm.transform.childCount; i++)
        {
            objects.Add(gm.transform.GetChild(i).gameObject);
        }
        return objects;
    }

    public static bool InitByIdentifier(this Transform tm, out GameObject identifier)
    {
        identifier = tm.Find(nameof(identifier))?.gameObject;
        if (!identifier) return false;
        else return true;
    }
}