Launch parameters

Note: The content on this page pertains to Game Server Hosting (Multiplay) available on the Unity Cloud Dashboard. If you’re using Game Server Hosting (Clanforge), refer to the Game Server Hosting (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.

VariableTypeDescriptionExample value
$$commandline$$stringA string of the launch parameters passed to the game server or application on launch.-config path/to/server.json
$$config_dir$$stringThe directory that contains the Unity configuration server.json./mnt/unity/
$$fleetid$$stringThe ID of the fleet of which the server is a member.5050693b-0bea-4752-858b-52c074d485fa
$$game_exe$$stringThe name of the build executable.server-linux
$$log_dir$$stringThe directory to which the server should send log files.
/mnt/unity/logs/
$$file_dir$$stringThe directory to which the server should send game files. Log files can also be written here.
/mnt/unity/files/
$$machineid$$integerThe ID of the machine on which the server is running.123456
$$port$$integerThe network port on which the server should bind for traffic.1234
$$query_port$$integerThe network port on which the server should bind for query protocol traffic.5678
$$query_type$$stringThe query protocol supported by the build the server is running.sqp
$$serverid$$integerThe ID of the server.123456
$$regionid$$stringThe ID of the region of which the server is a member.3d9e29e8-3bb3-4cab-9d11-b79c90d0934d
$$regionname$$stringThe name of the region of which the server is a member.North America
$$ip$$stringThe IP (version 4) address of the server.1.2.3.4
$$ipv6$$stringThe IP (version 6) address of the server.2001:db8:3333:4444:5555:6666:7777:8888
$$timestamp$$stringThe 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 parameterDescription
-nographicsRun the game executable without graphics.
-batchmodeRun Unity in batch mode. In batch mode, Unity runs command line arguments without the need for human interaction.
-logFileSpecify 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 parameterDescription
-logSpecify the location where the server saves log files.
-portSpecify 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$$