From 51497d37d2ea18aa4e439250119bb6f01224f519 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期五, 25 九月 2026 13:29:41 +0800
Subject: [PATCH] 0312 修复图集死循环问题
---
Assets/Editor/Tool/TexturePlatformFormatHelper.cs | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/Assets/Editor/Tool/TexturePlatformFormatHelper.cs b/Assets/Editor/Tool/TexturePlatformFormatHelper.cs
index 8e9ab95..c3a0d94 100644
--- a/Assets/Editor/Tool/TexturePlatformFormatHelper.cs
+++ b/Assets/Editor/Tool/TexturePlatformFormatHelper.cs
@@ -142,15 +142,28 @@
return changed;
}
+ /// <summary>
+ /// 浼氳鐪熸鍐欏叆 meta 鐨勫浘闆嗗钩鍙帮紙鍙湁 overridden=true 鐨勫钩鍙拌缃墠浼氳鎸佷箙鍖栵級銆�
+ /// Standalone / DefaultTexturePlatform 鎸夐渶姹備繚鎸侀粯璁わ紝涓嶅仛瑕嗙洊銆�
+ /// </summary>
+ public static readonly string[] OVERRIDDEN_ATLAS_PLATFORMS = { "Android", "iPhone", "WebGL" };
+
+ /// <summary>
+ /// 缁熶竴鍥鹃泦骞冲彴鐨� maxTextureSize銆�
+ /// 娉ㄦ剰锛氱粷涓嶈兘瀵� overridden=false 鐨勫钩鍙板啓 maxTextureSize 鈥斺�� 杩欑被璁剧疆涓嶄細琚寔涔呭寲锛�
+ /// 姣忔瀵煎叆璇诲洖鏉ヤ粛鏄粯璁ゅ�硷紝浼氳鍒ゆ垚"鏈夋敼鍔�"浠庤�屽湪 OnPostprocessAllAssets 閲屽弽澶�
+ /// SaveAndReimport锛屾渶缁堣Е鍙� Unity 鐨� "infinite import loop" 妫�娴嬨��
+ /// </summary>
public static bool ApplyAtlasMaxTextureSize(SpriteAtlasImporter importer)
{
bool changed = false;
- foreach (var platform in new[] { "Standalone", "Android", "iPhone", "WebGL", "DefaultTexturePlatform" })
+ foreach (var platform in OVERRIDDEN_ATLAS_PLATFORMS)
{
var settings = importer.GetPlatformSettings(platform);
- if (settings.maxTextureSize == ATLAS_MAX_SIZE)
+ if (settings.overridden && settings.maxTextureSize == ATLAS_MAX_SIZE)
continue;
+ settings.overridden = true;
settings.maxTextureSize = ATLAS_MAX_SIZE;
importer.SetPlatformSettings(settings);
changed = true;
--
Gitblit v1.8.0