public class CUtils
{
/// <summary>
/// find child by name
/// </summary>
/// <param name="transform"></param>
/// <param name="name"></param>
/// <returns></returns>
public static Transform GetChild(Transform transform, string name)
{
Transform final = null;
if (transform.Find(name) != null)
{
final = transform.Find(name);
return final;
}
else
{
for (int i = 0; i < transform.childCount; i++)
{
if (transform.GetChild(i).childCount != 0)
{
final = GetChild(transform.GetChild(i), name);
if (final != null)
break;
}
}
}
return final;
}
}