아틀라스 패킹 기능 추가
This commit is contained in:
parent
bcf28ee7c3
commit
57a7a1bcdd
@ -234,6 +234,14 @@ public static void CreateAtlas(string path, string destPath)
|
|||||||
sRGB = true,
|
sRGB = true,
|
||||||
generateMipMaps = false
|
generateMipMaps = false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 저장 후 설정 반영을 위해 동기 임포트, 그리고 즉시 패킹 수행
|
||||||
|
AssetDatabase.ImportAsset(destPath, ImportAssetOptions.ForceUpdate | ImportAssetOptions.ForceSynchronousImport);
|
||||||
|
var packedAtlas = AssetDatabase.LoadAssetAtPath<SpriteAtlas>(destPath);
|
||||||
|
if (packedAtlas != null)
|
||||||
|
{
|
||||||
|
SpriteAtlasUtility.PackAtlases(new[] { packedAtlas }, EditorUserBuildSettings.activeBuildTarget);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CreateSingleAtlas(string path, string destPath)
|
public static void CreateSingleAtlas(string path, string destPath)
|
||||||
@ -277,18 +285,34 @@ public static void CreateSingleAtlas(string path, string destPath)
|
|||||||
sRGB = true,
|
sRGB = true,
|
||||||
generateMipMaps = false
|
generateMipMaps = false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 저장 후 설정 반영을 위해 동기 임포트, 그리고 즉시 패킹 수행
|
||||||
|
AssetDatabase.ImportAsset(destPath, ImportAssetOptions.ForceUpdate | ImportAssetOptions.ForceSynchronousImport);
|
||||||
|
var packedAtlas = AssetDatabase.LoadAssetAtPath<SpriteAtlas>(destPath);
|
||||||
|
if (packedAtlas != null)
|
||||||
|
{
|
||||||
|
SpriteAtlasUtility.PackAtlases(new[] { packedAtlas }, EditorUserBuildSettings.activeBuildTarget);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void BuildTarget()
|
public static void BuildTarget()
|
||||||
{
|
{
|
||||||
foreach (var path in TargetPaths)
|
AssetDatabase.StartAssetEditing();
|
||||||
|
try
|
||||||
{
|
{
|
||||||
CreateAtlas(Utils.FolderPath(path),
|
foreach (var path in TargetPaths)
|
||||||
Utils.FolderPath(path).Replace(PathConstants.RawFolderPath, PathConstants.AddressablesFolderPath) +
|
{
|
||||||
ExtenstionConstants.SpriteAtlasExtenstionLower);
|
CreateAtlas(Utils.FolderPath(path),
|
||||||
|
Utils.FolderPath(path).Replace(PathConstants.RawFolderPath, PathConstants.AddressablesFolderPath) +
|
||||||
|
ExtenstionConstants.SpriteAtlasExtenstionLower);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
AssetDatabase.StopAssetEditing();
|
||||||
|
AssetDatabase.Refresh();
|
||||||
|
TargetPaths.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
TargetPaths.Clear();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user