コード例 #1
0
 public void SetNode(Transform node)
 {
     if (ExportToJson.IsPrefabAsset(node, true))
     {
         string     path = PrefabUtility.GetPrefabAssetPathOfNearestInstanceRoot(node);
         GameObject go   = AssetDatabase.LoadAssetAtPath <GameObject>(path);
         prefabName = go.name;
         //获取差异数据
         Transform _node = go.transform;
         if (_node.childCount > 0)
         {
             differ = new Differ();
             for (int i = 0; i < _node.childCount; i++)
             {
                 if (differ.child == null)
                 {
                     differ.child = new List <Differ>();
                 }
                 Transform tmp     = _node.GetChild(i);
                 Transform _tmp    = node.GetChild(i);
                 Differ    _differ = Differ.getDiffer(tmp, _tmp, i);
                 if (_differ != null)
                 {
                     differ.child.Add(_differ);
                 }
             }
             if (differ.child == null || differ.child.Count == 0)
             {
                 differ = null;
             }
         }
         return;
     }
     nodeTran = node;
     for (int i = 0; i < nodeTran.childCount; i++)
     {
         Transform tmp = nodeTran.GetChild(i);
         if (child == null)
         {
             child = new List <Child>();
         }
         child.Add(ExportToJson.SetChild(tmp));
     }
 }
コード例 #2
0
ファイル: ExportToJson.cs プロジェクト: liwensong521/mini
 public void SetNode(Transform node)
 {
     if (ExportToJson.IsPrefabAsset(node, true))
     {
         string     path = PrefabUtility.GetPrefabAssetPathOfNearestInstanceRoot(node);
         GameObject go   = AssetDatabase.LoadAssetAtPath <GameObject>(path);
         prefabName = go.name;
         return;
     }
     nodeTran = node;
     for (int i = 0; i < nodeTran.childCount; i++)
     {
         Transform tmp = nodeTran.GetChild(i);
         if (child == null)
         {
             child = new List <Child>();
         }
         child.Add(ExportToJson.SetChild(tmp));
     }
 }