Launch parameters
Note: The content on this page pertains to Multiplay Hosting, available on the Unity Cloud Dashboard. If you’re using Clanforge, refer to Clanforge documentation.
Launch parameters are variables passed to a game server at the time of start-up. These variables load before any other configuration variables and are separate from configuration variables and the server.json
file. Launch parameters are best suited for loading information that the server needs access to immediately after starting.
You might want to use a launch parameter instead of a configuration variable in the following scenarios:
- Initialize a port number.
- Set the log directory.
However, it makes more sense to use configuration variables instead of launch parameters in most cases.
You must encase each launch parameter variable in dollar symbols ($$
), two on each side. For example, a launch parameter named port
converts to $$port$$
. The following code snippet has example launch parameters.
-port $$port$$ -queryport $$query_port$$ -log $$log_dir$$
Server variables
Like build configuration variables, you can use the following server-specific variables in your launch parameters. The following table has example server variables, each with a type, description, and example value.
Variable | Type | Description | Example value |
---|---|---|---|
$$commandline$$ | string | A string of the launch parameters passed to the game server or application on launch. | -config path/to/server.json |
$$config_dir$$ | string | The directory that contains the Unity configuration server.json. | /mnt/unity/ |
$$fleetid$$ | string | The ID of the fleet of which the server is a member. | 5050693b-0bea-4752-858b-52c074d485fa |
$$game_exe$$ | string | The name of the build executable. | server-linux |
$$log_dir$$ | string | The directory to which the server should send log files. | /mnt/unity/logs/ |
$$file_dir$$ | string | The directory to which the server should send game files. Log files can also be written here. | /mnt/unity/files/ |
$$machineid$$ | integer | The ID of the machine on which the server is running. | 123456 |
$$port$$ | integer | The network port on which the server should bind for traffic. | 1234 |
$$query_port$$ | integer | The network port on which the server should bind for query protocol traffic. | 5678 |
$$query_type$$ | string | The query protocol supported by the build the server is running. | sqp |
$$serverid$$ | integer | The ID of the server. | 123456 |
$$regionid$$ | string | The ID of the region of which the server is a member. | 3d9e29e8-3bb3-4cab-9d11-b79c90d0934d |
$$regionname$$ | string | The name of the region of which the server is a member. | North America |
$$ip$$ | string | The IP (version 4) address of the server. | 1.2.3.4 |
$$ipv6$$ | string | The IP (version 6) address of the server. | 2001:db8:3333:4444:5555:6666:7777:8888 |
$$timestamp$$ | string | The UTC timestamp of when the server started. | 1661430055 |
Default launch parameters
The following sections display the default launch parameters for games made with Unity and games made with Unreal.
Note: Build configuration variables are encased in double dollar symbols ($$
).
Unity
The default launch parameters for games made with Unity include -nographics
, -batchmode
, and -logFile
.
Tip: Refer to Unity Editor command line arguments to learn more about the different flags you can use.
-nographics -batchmode -port $$port$$ -logFile $$log_dir$$/Engine.log
Launch parameter | Description |
---|---|
-nographics | Run the game executable without graphics. |
-batchmode | Run Unity in batch mode. In batch mode, Unity runs command line arguments without the need for human interaction. |
-logFile | Specify the location where the server saves log files. It accepts a directory relative to the server ID and can include build configuration variables. |
Depending on the game, the launch parameters might also include the query port (queryPort
) and query protocol (queryType
).
-nographics -batchmode -logFile $$log_dir$$/Engine.log -queryPort $$query_port$$ -queryType $$query_type$$
Unreal
The default launch parameters for games made with Unreal include -log
, and -port
.
Tip: Refer to Unreal Engine command line arguments to learn more about the different flags you can use.
-log=$serverid.log -port=$$port$$
Launch parameter | Description |
---|---|
-log | Specify the location where the server saves log files. |
-port | Specify the port clients can use to connect to the game server. |
Depending on the game and SDK you’re using, the launch parameters might include the query port (queryPort
) and query protocol (queryType
).
-log=$serverid.log -port=$$port$$ -queryPort $$query_port$$ -queryType $$query_type$$