diff --git a/Editor/Platforms/WebGL/BuildWebGL.cs b/Editor/Platforms/WebGL/BuildWebGL.cs index 7c83528..9c9bf99 100644 --- a/Editor/Platforms/WebGL/BuildWebGL.cs +++ b/Editor/Platforms/WebGL/BuildWebGL.cs @@ -1,25 +1,23 @@ -#if UNITY_WEBGL - using System.Threading.Tasks; using UnityEditor; using UnityEditor.Build; using UnityEditor.Build.Reporting; -using UnityEditor.WebGL; using UnityEngine; - +#if UNITY_WEBGL +using UnityEditor.WebGL; #endif namespace UniTools.Build { -#if UNITY_WEBGL - [CreateAssetMenu( fileName = nameof(BuildWebGL), menuName = MenuPaths.WebGL + nameof(BuildWebGL) )] public sealed class BuildWebGL : ScriptableBuildStepWithOptions { +#if UNITY_WEBGL [SerializeField] private CodeOptimization m_codeOptimization = CodeOptimization.Size; +#endif [SerializeField] private Il2CppCodeGeneration m_IL2CPPCodeGeneration = Il2CppCodeGeneration.OptimizeSize; [SerializeField] private WebGLExceptionSupport m_exceptionSupport = WebGLExceptionSupport.None; [SerializeField] private WebGLCompressionFormat m_compressionFormat = default; @@ -41,8 +39,11 @@ public override async Task Execute() PlayerSettings.WebGL.dataCaching = m_dataCaching; PlayerSettings.WebGL.debugSymbolMode = m_debugSymbolMode; PlayerSettings.WebGL.decompressionFallback = m_decompressionFallback; - - EditorUserBuildSettings.SetPlatformSettings(UnityEditor.BuildPipeline.GetBuildTargetName(BuildTarget.WebGL), "CodeOptimization", m_codeOptimization.ToString()); // or "size" +#if UNITY_WEBGL + EditorUserBuildSettings.SetPlatformSettings(UnityEditor.BuildPipeline.GetBuildTargetName(BuildTarget.WebGL), "CodeOptimization", m_codeOptimization.ToString()); +#else + EditorUserBuildSettings.SetPlatformSettings(UnityEditor.BuildPipeline.GetBuildTargetName(BuildTarget.WebGL), "CodeOptimization", "Size"); +#endif EditorUserBuildSettings.il2CppCodeGeneration = m_IL2CPPCodeGeneration; AssetDatabase.Refresh(); @@ -57,4 +58,4 @@ public override async Task Execute() } #endif -} \ No newline at end of file + } \ No newline at end of file