public static AtlasRaw Pack(string targetFolder, IPackSprite[] textures, PackSetting setting) { EditorUtility.DisplayProgressBar("", "generate atlas...", 0.5f); var atlasPath = Path.Combine(targetFolder, PackConst.DefaultAtlasAssetName); atlasPath = AssetDatabase.GenerateUniqueAssetPath(atlasPath); var atlasRaw = new PackAtlas(setting, atlasPath, textures).GenerateAtlas(); EditorUtility.ClearProgressBar(); return(atlasRaw); }
public static AtlasRaw Repack(AtlasRaw atlasRaw, IPackSprite[] textures = null, PackSetting setting = null) { EditorUtility.DisplayProgressBar("", "repack atlas...", 0.5f); textures = textures ?? PackAtlasSprite.ListSprites(atlasRaw); setting = setting ?? new PackSetting(atlasRaw.maxSize, atlasRaw.padding, atlasRaw.isPOT, atlasRaw.forceSquare); var atlasPath = AssetDatabase.GetAssetPath(atlasRaw); atlasRaw = new PackAtlas(setting, atlasPath, textures).GenerateAtlas(); EditorUtility.ClearProgressBar(); if (atlasRaw == null) { Debug.LogError("Pack failed."); return(null); } RefreshUI(); return(atlasRaw); }