Assets/Editor/Tool/UpdateAssetBundleName.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
Assets/Launch/ResourcesModel.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
Assets/Editor/Tool/UpdateAssetBundleName.cs
@@ -59,16 +59,16 @@ // EditorUtility.SetDirty(importer); } allFiles = new DirectoryInfo(rootPath).GetFiles("*.png", SearchOption.AllDirectories); //allFiles = new DirectoryInfo(rootPath).GetFiles("*.png", SearchOption.AllDirectories); foreach (var file in allFiles) { var pathStringArray = file.DirectoryName.Split(Path.DirectorySeparatorChar); var importerPath = spriteRelativePath + Path.DirectorySeparatorChar + pathStringArray[pathStringArray.Length - 1] + Path.DirectorySeparatorChar + file.Name; var importer = AssetImporter.GetAtPath(importerPath); importer.assetBundleName = "ui/sprite/" + pathStringArray[pathStringArray.Length - 1].ToLower(); // EditorUtility.SetDirty(importer); } //foreach (var file in allFiles) //{ // var pathStringArray = file.DirectoryName.Split(Path.DirectorySeparatorChar); // var importerPath = spriteRelativePath + Path.DirectorySeparatorChar + pathStringArray[pathStringArray.Length - 1] + Path.DirectorySeparatorChar + file.Name; // var importer = AssetImporter.GetAtPath(importerPath); // importer.assetBundleName = "ui/sprite/" + pathStringArray[pathStringArray.Length - 1].ToLower(); // // EditorUtility.SetDirty(importer); //} DebugEx.Log("Sprite资源包名更新完成!"); Assets/Launch/ResourcesModel.cs
@@ -104,6 +104,8 @@ AssetBundle spriteBundle = null; //需要卸载 AssetBundle prefabBundle = null; //需要卸载 SpriteAtlas spriteAtlas = null; public void Init() { //if (Application.isMobilePlatform) @@ -170,6 +172,7 @@ prefabBundle?.Unload(true); assetVersions = null; localAssetVersions = null; spriteAtlas = null; Debug.Log("提前ResourcesModel.Destroy资源"); } @@ -269,12 +272,16 @@ } #else if (spriteBundle == null) { string _path = GetAssetFilePath("builtin/sprites"); spriteBundle = AssetBundle.LoadFromFile(_path); } sprite = spriteBundle.LoadAsset(name, typeof(Sprite)) as Sprite; if (spriteBundle == null) { string _path = GetAssetFilePath("builtin/sprites"); spriteBundle = AssetBundle.LoadFromFile(_path); } if (spriteAtlas == null) { spriteAtlas = spriteBundle.LoadAsset("sprites", typeof(SpriteAtlas)) as SpriteAtlas; } sprite = spriteAtlas.GetSprite(name); #endif if (sprite == null) {