From d5c61ed998a38d62a03f4d58e4d2fe9516d27ea3 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期四, 24 九月 2026 14:51:26 +0800
Subject: [PATCH] 自动图集设置
---
Assets/Editor/Tool/TexturePlatformFormatHelper.cs | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/Assets/Editor/Tool/TexturePlatformFormatHelper.cs b/Assets/Editor/Tool/TexturePlatformFormatHelper.cs
index 472544a..8e9ab95 100644
--- a/Assets/Editor/Tool/TexturePlatformFormatHelper.cs
+++ b/Assets/Editor/Tool/TexturePlatformFormatHelper.cs
@@ -18,7 +18,7 @@
public const string TARGET_FOLDER = "Assets/ResourcesOut";
// ---- 鍥鹃泦鍥哄畾灏哄 ----
- public const int ATLAS_MAX_SIZE = 2048;
+ public const int ATLAS_MAX_SIZE = 1024;
// ---- 鍘嬬缉璐ㄩ噺 ----
public const int COMPRESSION_QUALITY = 50;
@@ -92,7 +92,7 @@
/// </summary>
public static bool ApplyAtlasPlatformSettings(SpriteAtlasImporter importer)
{
- bool changed = false;
+ bool changed = ApplyAtlasMaxTextureSize(importer);
// Android 鈫� ETC2_RGBA8锛堝浘闆嗗缁堝惈 Alpha锛�
{
@@ -142,6 +142,23 @@
return changed;
}
+ public static bool ApplyAtlasMaxTextureSize(SpriteAtlasImporter importer)
+ {
+ bool changed = false;
+ foreach (var platform in new[] { "Standalone", "Android", "iPhone", "WebGL", "DefaultTexturePlatform" })
+ {
+ var settings = importer.GetPlatformSettings(platform);
+ if (settings.maxTextureSize == ATLAS_MAX_SIZE)
+ continue;
+
+ settings.maxTextureSize = ATLAS_MAX_SIZE;
+ importer.SetPlatformSettings(settings);
+ changed = true;
+ }
+
+ return changed;
+ }
+
// ============================================================
// 宸ュ叿鏂规硶
// ============================================================
--
Gitblit v1.8.0