void Awake()
{
var rootNodeInst = UnityEngine.Object.Instantiate(rootNode) as GameObject;
UnityEngine.Object.DontDestroyOnLoad(rootNodeInst);
var header = rootNodeInst.transform.Find(“PanelHeader”);
}
But, the header is null !!!, when I debug into this line, I find the PanelHeader gameobject is invisible, in the scene, why?? Very Appreciate any reply!
Maybe You made spelling mistake? Maybe some white characters?
Check the prefab, maybe it doesn’t have those children?
Take a note: Find does not perform a recursive descend down a Transform hierarchy. If no child with n can be found, null is returned. If n contains a ‘/’ character it will access the Transform in the hierarchy like a path name. (from docs: Unity - Scripting API: Transform.Find)
also, make sure your object is ACTIVE, if it’s not, Find won’t find it. If you want it to be inactive, just after getting it, make it inactive.
if it’s all ok to you, print there all children names and see if it sees yours?