public UnityEngine.Object[] GetAllAssets(string path, bool bSearchChild, string searchPattern) { List <string> assets = new List <string>(); BuildAssetStruct.GetAllAssetsString(path, assets, bSearchChild, searchPattern); List <UnityEngine.Object> objs = new List <UnityEngine.Object>(); foreach (string asset in assets) { string s = GetAssetPath(asset); objs.Add(AssetDatabase.LoadAssetAtPath(s, typeof(UnityEngine.Object))); } return(objs.ToArray()); }
public void test() { Md5Manager.Instance.Start(); string mapName = "Town_01"; string mapPath = "Map/" + mapName + ".unity"; string path = Path.Combine(Application.dataPath, mapPath); EditorApplication.OpenScene(path); GameObject scene = GameObject.Find("Scene"); if (scene) { BundleDependency bd = Md5Manager.Instance.CreateBundleDependency(mapName); Object[] objs = new Object[1] { scene }; //dependency Object[] rets = EditorUtility.CollectDependencies(objs); Debug.Log("rets:" + rets.Length); foreach (Object oc in rets) { Debug.Log("dep:" + oc.ToString()); string s = AssetDatabase.GetAssetPath(oc); bd.AddFileName(s); Debug.Log("path:" + s); } //child prefab Transform[] trans = scene.GetComponentsInChildren <Transform>(); foreach (Transform t in trans) { GameObject child = t.gameObject; if (PrefabType.None == EditorUtility.GetPrefabType(child)) { continue; } if ((Object)child != EditorUtility.FindPrefabRoot(child)) { continue; } Debug.Log("prefab:" + child.ToString()); string s = AssetDatabase.GetAssetPath(EditorUtility.GetPrefabParent(child)); bd.AddFileName(s); Debug.Log("prefabPath:" + s); } bd.AddFileName(path); List <string> assets = new List <string>(); string lightMapPath = Path.Combine(Application.dataPath, "Map/" + mapName); BuildAssetStruct.GetAllAssetsString(lightMapPath, assets, true); foreach (string s in assets) { bd.AddFileName(s); } Debug.Log("result:" + mapName + bd.GetDirty().ToString()); bd.PrintDirtyFile(); } Md5Manager.Instance.CheckVerion(); Md5Manager.Instance.End(); }