fix: Edgegap Plugin now creates Dedicated Server instead of Headless --nographics builds which should include #UNITY_SERVER define

This commit is contained in:
mischa 2023-11-06 09:24:34 +01:00
parent bccebc67b4
commit de4ce2e468

View File

@ -19,14 +19,23 @@ internal static class EdgegapBuildUtils
public static BuildReport BuildServer() 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<string> scenes = EditorBuildSettings.scenes.Select(s=>s.path); IEnumerable<string> scenes = EditorBuildSettings.scenes.Select(s=>s.path);
BuildPlayerOptions options = new BuildPlayerOptions BuildPlayerOptions options = new BuildPlayerOptions
{ {
scenes = scenes.ToArray(), scenes = scenes.ToArray(),
target = BuildTarget.StandaloneLinux64, target = BuildTarget.StandaloneLinux64,
#pragma warning disable CS0618 // disable deprecated warning until Edgegap updates this // MIRROR CHANGE
options = BuildOptions.EnableHeadlessMode, // options = BuildOptions.EnableHeadlessMode, // obsolete and missing UNITY_SERVER define
#pragma warning restore CS0618 subtarget = (int)StandaloneBuildSubtarget.Server, // dedicated server with UNITY_SERVER define
// END MIRROR CHANGE
locationPathName = "Builds/EdgegapServer/ServerBuild" locationPathName = "Builds/EdgegapServer/ServerBuild"
}; };