https://answers.unity.com/questions/52560/gameobjectfind-work-on-inactive-objects.html
GameObject.Find()只能找到active的物体
Transform.Find()和Transform.FindChild()能找到active为false的物体,其中FindChild()方法已过时,不推荐使用。
GameObject test1 = GameObject.Find("Cube/Cube1");
GameObject test2 = transform.Find("Cube1").gameObject;
if (test1 == null)
{
Debug.LogError("test1 is null");
}
if (test2 == null)
{
Debug.LogError("test2 is null");
}