unity check if object has child code example
Example: unity check if child exists
Transform[] ts = GetComponentsInChildren<Transform>();
foreach(Transform t in ts)
{
if(t != null)
{
//do something
}
}