Search Unity

What is the BuildTargetGroup for the Dedicated Server platform?

Discussion in 'Multiplayer' started by Deleted User, Apr 19, 2023.

  1. Deleted User

    Deleted User

    Guest

    There seems to be a BuildTargetGroup enum for every platform except for Dedicated Server. What is the BuildTargetGroup for the Dedicated Server platform?

    One use case is to switch the editor into the Dedicated Server platform programatically, as a part of some script:
    Code (CSharp):
    1. var buildTarget = BuildTarget.Android;
    2. SwitchActiveBuildTarget(buildTarget);
    but I cannot find either a BuildTarget or BuildTarget group for the Dedicated Server platform (Unity - Scripting API: BuildTarget (unity3d.com), Unity - Scripting API: BuildTargetGroup (unity3d.com))
     
    Last edited by a moderator: Apr 19, 2023
  2. cristianm_unity

    cristianm_unity

    Unity Technologies

    Joined:
    Oct 16, 2018
    Posts:
    259
    Hey! Dedicated Server build target group is Standalone. That is because Dedicated Server is a subtarget of the Standalone target.

    So switching to Dedicated Server would be something like
    Code (CSharp):
    1. EditorUserBuildSettings.standaloneBuildSubtarget = StandaloneBuildSubtarget.Server;
    2. EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTarget.StandaloneWindows64);
    On the other hand, if you want to define some player settings specifically for Dedicated Server you need to use the NamedBuildTarget:
    Code (CSharp):
    1. PlayerSettings.SetScriptingBackend(NamedBuildTarget.Server, ScriptingImplementation.IL2CPP);
     
    Deleted User likes this.
  3. Deleted User

    Deleted User

    Guest

    Thank you @cristianm_unity, very cool.