Files

27 lines
856 B
C#

using UnityEditor;
using UnityEditor.Callbacks;
using System.IO;
using UnityEngine;
public class GradleFixer
{
[PostProcessBuild]
public static void OnPostBuild(BuildTarget target, string path)
{
if (target != BuildTarget.Android) return;
// string wrapperPath = Path.Combine(path, "gradle", "wrapper", "gradle-wrapper.properties");
// string customContent = "distributionUrl=gradle-8.7-bin.zip";
//
// if (File.Exists(wrapperPath))
// {
// File.WriteAllText(wrapperPath, customContent);
// Debug.Log("✅ gradle-wrapper.properties 已替换为自定义版本");
// }
// else
// {
// Debug.LogWarning("⚠️ 未找到 gradle-wrapper.properties,可能 Unity 构建未生成 wrapper");
// }
}
}