public static void TryRecordToNaviNode(NaviNode naviNode, RectTransform targetTrans)
        {
            Debug.Log("[record]:" + targetTrans.name);
            TryRecordTransInfo(naviNode, targetTrans);
            var pfb = PrefabUtility.GetPrefabParent(targetTrans);

            if (pfb != null)
            {
                var pfbRoot = PrefabUtility.FindPrefabRoot((pfb as Transform).gameObject);
                naviNode.id   = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(pfbRoot));
                naviNode.path = new List <string>();
                var trans = pfb as Transform;
                while (trans.gameObject != pfbRoot)
                {
                    naviNode.path.Insert(0, trans.name);
                    trans = trans.parent;
                }
            }
            else
            {
                var active = UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene();
                naviNode.id   = active.name;
                naviNode.path = new List <string>();
                var trans = targetTrans.transform;
                while (trans != null)
                {
                    naviNode.path.Insert(0, trans.name);
                    trans = trans.parent;
                }
            }
        }
        private static void TryRecordTransInfo(NaviNode node, RectTransform trans)
        {
            node.naviNodes.Clear();
            var currTrans = trans;

            while (currTrans.GetComponent <Canvas>() == null)
            {
                var tnode = RecordOneTransform(currTrans);
                node.naviNodes.Insert(0, tnode);
                currTrans = currTrans.parent as RectTransform;
            }
        }
        public static Transform FindTransformDeep(Transform root, NaviNode item, int startid = 0)
        {
            var       path   = item.path.ToArray();
            Transform target = root;

            for (int i = startid; i < path.Length; i++)
            {
                if (target == null)
                {
                    OnUpdateError(item, "找到到:" + path[i]);
                    break;
                }
                else
                {
                    target = target.FindChild(path[i]);
                }
            }
            return(target);
        }
 private static void OnUpdateError(NaviNode item, string info)
 {
     Debug.Log(item.name + ":路径记录错误,请重新关联\n" + info);
 }