Exemple #1
0
        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);
        }
Exemple #2
0
        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();
        }