private void DrawFixSettings() { bool isRuntimeVersionFixed; bool isLinkTargetFixed; bool isMemorySizeFixed; bool isDecompressionFallbackFixed; PlayerSettingsChecker.GetSettingsFixed(out isRuntimeVersionFixed, out isLinkTargetFixed, out isMemorySizeFixed, out isDecompressionFallbackFixed); bool isAllFixed = isRuntimeVersionFixed && isLinkTargetFixed && isMemorySizeFixed && isDecompressionFallbackFixed; if (isAllFixed) { var str = "All Settings Fixed:"; str += "\n√ PlayerSettings.WebGL.linkerTarget = " + PlayerSettings.WebGL.linkerTarget + ";"; str += "\n√ PlayerSettings.WebGL.memorySize = " + PlayerSettings.WebGL.memorySize + ";"; str += "\n√ PlayerSettings.WebGL.decompressionFallback = true;"; #if !UNITY_2019_3_OR_NEWER str += "\n√ PlayerSettings.scriptingRuntimeVersion = ScriptingRuntimeVersion.Latest;"; #endif EditorGUI.HelpBox(new Rect(10, 90, 580, 62), str, MessageType.Info); GUI.enabled = false; GUI.Button(new Rect(440, 158, 150, 18), "All Fixed"); GUI.enabled = true; return; } var fixStr = "In order to run UnityWebSocket normally, we must fix some SETTINGS below:"; if (isLinkTargetFixed) { fixStr += "\n√ PlayerSettings.WebGL.linkerTarget = " + PlayerSettings.WebGL.linkerTarget + ";"; } else { fixStr += "\n× PlayerSettings.WebGL.linkerTarget = [Appropriate Value];"; } if (isMemorySizeFixed) { fixStr += "\n√ PlayerSettings.WebGL.memorySize = " + PlayerSettings.WebGL.memorySize + ";"; } else { fixStr += "\n× PlayerSettings.WebGL.memorySize = [Appropriate Value];"; } if (isDecompressionFallbackFixed) { fixStr += "\n√ PlayerSettings.WebGL.decompressionFallback = true;"; } else { fixStr += "\n× PlayerSettings.WebGL.decompressionFallback = false;"; } #if !UNITY_2019_3_OR_NEWER if (isRuntimeVersionFixed) { fixStr += "\n√ PlayerSettings.scriptingRuntimeVersion = ScriptingRuntimeVersion.Latest;"; } else { fixStr += "\n× PlayerSettings.scriptingRuntimeVersion = ScriptingRuntimeVersion.Legacy; (Need Manual Fix)"; } #endif EditorGUI.HelpBox(new Rect(10, 90, 580, 62), fixStr, MessageType.Warning); if (GUI.Button(new Rect(440, 158, 150, 18), "Auto Fix")) { #if UNITY_2018_1_OR_NEWER if (!isLinkTargetFixed) { PlayerSettings.WebGL.linkerTarget = (WebGLLinkerTarget)2; } #endif if (!isMemorySizeFixed) { PlayerSettings.WebGL.memorySize = ASM_MEMORY_SIZE[0]; } #if UNITY_2020_1_OR_NEWER if (!isDecompressionFallbackFixed) { PlayerSettings.WebGL.decompressionFallback = true; } #endif if (!isRuntimeVersionFixed) { EditorUtility.DisplayDialog("UnityWebSocket", "ScriptingRuntimeVersion (.Net 4.x) Need Manual Fix.", "OK"); } } }
private void DrawFixSettings() { bool isLinkTargetFixed; bool isMemorySizeFixed; bool isDecompressionFallbackFixed; PlayerSettingsChecker.GetSettingsFixed(out isLinkTargetFixed, out isMemorySizeFixed, out isDecompressionFallbackFixed); bool isAllFixed = isLinkTargetFixed && isMemorySizeFixed && isDecompressionFallbackFixed; if (isAllFixed) { var str = "All Settings Fixed:"; str += "\n√ PlayerSettings.WebGL.linkerTarget = " + PlayerSettings.WebGL.linkerTarget + ";"; str += "\n√ PlayerSettings.WebGL.memorySize = " + PlayerSettings.WebGL.memorySize + ";"; str += "\n√ PlayerSettings.WebGL.decompressionFallback = true;"; EditorGUI.HelpBox(new Rect(10, 90, 330, 86), str, MessageType.Info); GUI.enabled = false; GUI.Button(new Rect(440, 158, 150, 18), "All Fixed"); GUI.enabled = true; return; } var fixStr = "In order to run UnityWebSocket normally, we must fix some SETTINGS below:"; if (isLinkTargetFixed) { fixStr += "\n√ PlayerSettings.WebGL.linkerTarget = " + PlayerSettings.WebGL.linkerTarget + ";"; } else { fixStr += "\n× PlayerSettings.WebGL.linkerTarget = [Appropriate Value];"; } if (isMemorySizeFixed) { fixStr += "\n√ PlayerSettings.WebGL.memorySize = " + PlayerSettings.WebGL.memorySize + ";"; } else { fixStr += "\n× PlayerSettings.WebGL.memorySize = [Appropriate Value];"; } if (isDecompressionFallbackFixed) { fixStr += "\n√ PlayerSettings.WebGL.decompressionFallback = true;"; } else { fixStr += "\n× PlayerSettings.WebGL.decompressionFallback = false;"; } EditorGUI.HelpBox(new Rect(10, 90, 330, 86), fixStr, MessageType.Warning); if (GUI.Button(new Rect(440, 158, 150, 18), "Auto Fix")) { #if UNITY_2018_1_OR_NEWER if (!isLinkTargetFixed) { PlayerSettings.WebGL.linkerTarget = (WebGLLinkerTarget)2; } #endif if (!isMemorySizeFixed) { PlayerSettings.WebGL.memorySize = ASM_MEMORY_SIZE[0]; } #if UNITY_2020_1_OR_NEWER if (!isDecompressionFallbackFixed) { PlayerSettings.WebGL.decompressionFallback = true; } #endif } }