From de4ce2e46824c901465446536ef509a67156fa8f Mon Sep 17 00:00:00 2001 From: mischa Date: Mon, 6 Nov 2023 09:24:34 +0100 Subject: [PATCH] fix: Edgegap Plugin now creates Dedicated Server instead of Headless --nographics builds which should include #UNITY_SERVER define --- .../Hosting/Edgegap/Editor/EdgegapBuildUtils.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Assets/Mirror/Hosting/Edgegap/Editor/EdgegapBuildUtils.cs b/Assets/Mirror/Hosting/Edgegap/Editor/EdgegapBuildUtils.cs index 8bad9d62d..4683e4e53 100755 --- a/Assets/Mirror/Hosting/Edgegap/Editor/EdgegapBuildUtils.cs +++ b/Assets/Mirror/Hosting/Edgegap/Editor/EdgegapBuildUtils.cs @@ -19,14 +19,23 @@ internal static class EdgegapBuildUtils public static BuildReport BuildServer() { + // MIRROR CHANGE + // Switch to the desired build target. As of 2021.3.19f1 there is a bug where + // appropriate scripts are not being executed by BuildPlayer. + // https://forum.unity.com/threads/unity-2021-2-dedicated-server-target-and-stripping-optimizations-now-live-please-share-feedback.1143734/page-4 + EditorUserBuildSettings.standaloneBuildSubtarget = StandaloneBuildSubtarget.Server; + EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.LinuxHeadlessSimulation, BuildTarget.StandaloneLinux64); + // END MIRROR CHANGE + IEnumerable scenes = EditorBuildSettings.scenes.Select(s=>s.path); BuildPlayerOptions options = new BuildPlayerOptions { scenes = scenes.ToArray(), target = BuildTarget.StandaloneLinux64, - #pragma warning disable CS0618 // disable deprecated warning until Edgegap updates this - options = BuildOptions.EnableHeadlessMode, - #pragma warning restore CS0618 + // MIRROR CHANGE + // options = BuildOptions.EnableHeadlessMode, // obsolete and missing UNITY_SERVER define + subtarget = (int)StandaloneBuildSubtarget.Server, // dedicated server with UNITY_SERVER define + // END MIRROR CHANGE locationPathName = "Builds/EdgegapServer/ServerBuild" };