Build your application for Dedicated Server
Describes how to create a build for Dedicated Server platform.
Read time 2 minutesLast updated 16 days ago
You can create a Dedicated Server build in either of the following ways:
Unity Editor
To create a Dedicated Server build in the Unity Editor, use the following steps:
- Open the Build Profiles window from File > Build Profiles.
- Select Add Build Profile to open the Platform Browser window.
- Select the type of server to build from the list of available platforms. For example, select Linux Server to build a Linux server.
- If the server type isn't available, select Install with Unity Hub and follow the installation instructions. For information on how to install modules, refer to Add modules.
- Select Switch Profile to set the new build profile as the active profile.
- Click Build.
Scripting
To create a Dedicated Server build using a script, set to .
buildPlayerOptions.subtarget(int)StandaloneBuildSubtarget.ServerbuildPlayerOptions.target = BuildTarget.StandaloneWindows;// SubTarget expects an integer.buildPlayerOptions.subtarget = (int)StandaloneBuildSubtarget.Server;
Unity defines the scripting symbol when you build for the Dedicated Server platform. You can use this symbol in your scripts to compile code for the server. For more information, refer to Scripting symbol reference.
UNITY_SERVERCommand line
To create a Dedicated Server build through the command line, use the argument.
-standaloneBuildSubtarget Server-buildTarget Linux64 -standaloneBuildSubtarget Server
A Dedicated Server build is a headless executable with no graphical interface. To interact with and configure your server application at runtime, use the Unity Player command line arguments and the DedicatedServer.Arguments API.
Code sign macOS Dedicated Server builds
Dedicated Server builds that aren't code signed might display security warnings when deployed on macOS systems. To avoid such warnings, make sure you code sign the build before distribution. For more information, refer to the documentation on Code sign and notarize your macOS application.