private static string[] OnWillSaveAssets(string[] paths) { if (ToolsExtends.enabledAutoAMF == false) { return(paths); } SaveGUIDMap map = SaveGUIDMap.Get(); bool has = false; foreach (string path in paths) { if (path.EndsWith(".prefab")) { try { PrefabFileRefGet prefabFileRefGet = PrefabFileRefGet.get(path); map.add(prefabFileRefGet); has = true; } catch (Exception) { Debug.LogError("保存Prefab guid出错 :" + path); } } } if (has) { map.save(); } return(paths); }
public static void initPluginDlls() { List <string> dlls = FileHelper.FindFile("Assets/Plugins/", new string[] { "*.dll" }); SaveGUIDMap saveGuidMap = Get(); bool hasNew = false; foreach (string dllItem in dlls) { string dllPath = dllItem.Replace(Application.dataPath, "Assets"); Dictionary <int, string> dic = FileIDUtil.getAllFileIDByDll(dllPath); if (dic == null) { continue; } foreach (int key in dic.Keys) { if (saveGuidMap.addFileID(key.ToString(), dic[key], false)) { hasNew = true; } } } if (hasNew) { saveGuidMap.save(); } }
public static void GetProjectAllGUID() { string[] allAssetPaths = AssetDatabase.GetAllAssetPaths(); string path = "Assets/GuidMapping/" + SystemInfo.deviceUniqueIdentifier + "_a.amf"; SaveGUIDMap guidMap = SaveGUIDMap.Get(path); foreach (string assetPath in allAssetPaths) { string guid = AssetDatabase.AssetPathToGUID(assetPath); if (string.IsNullOrEmpty(guid)) { continue; } guidMap.addGuid(guid, assetPath, false); } guidMap.save(); }