三国卡牌客户端基础资源仓库
hch
2026-09-25 51497d37d2ea18aa4e439250119bb6f01224f519
Assets/Editor/Tool/TexturePlatformAssetPostprocessor.cs
@@ -15,6 +15,11 @@
    private static readonly string TARGET_FOLDER = TexturePlatformFormatHelper.TARGET_FOLDER;
    private static readonly bool AUTO_APPLY_ATLAS_SETTINGS = true;
    /// <summary>
    /// 防止回调中 SaveAndReimport 同步触发下一次 OnPostprocessAllAssets 造成嵌套重入。
    /// </summary>
    private static bool s_IsApplying;
    void OnPreprocessTexture()
    {
        if (!assetPath.StartsWith(TARGET_FOLDER))
@@ -38,7 +43,13 @@
    {
        if (!AUTO_APPLY_ATLAS_SETTINGS)
            return;
        // 回调里的 SaveAndReimport 会同步再次触发本回调,必须挡掉,否则会无限自触发
        if (s_IsApplying)
            return;
        s_IsApplying = true;
        try
        {
        foreach (var assetPath in importedAssets)
        {
            if (!assetPath.StartsWith(TARGET_FOLDER))
@@ -64,4 +75,9 @@
            }
        }
    }
        finally
        {
            s_IsApplying = false;
        }
    }
}