Class ServerStartup
- Namespace
- Unity.Multiplayer.Core
Loads a dedicated server's settings the way the server package promises: the defaults, then server.json,
then the environment (NetEnvironment), then the command line (NetCommandLine and the
package arguments below), each layer overriding the one before.
public static class ServerStartup
- Inheritance
-
ServerStartup
- Inherited Members
Remarks
Package arguments (names ignore case; the value is the next argument or follows =):
-config | The settings file to read instead of server.json in the package folder (relative to the package folder). |
-healthport | Health endpoint TCP port, 0 for off (HealthPort). |
-admin | on or off; alone it means on (AdminCommands). |
-logs / -saves | Logs and saves folders (LogsDirectory, SavesDirectory). |
The session arguments -port -maxPlayers -name -password and the rest are NetCommandLine's.
Fields
AdminArg
Turns the admin console on or off.
public const string AdminArg = "-admin"
Field Value
ConfigArg
Selects the settings file.
public const string ConfigArg = "-config"
Field Value
HealthPortArg
Sets the health endpoint port.
public const string HealthPortArg = "-healthport"
Field Value
LogsArg
Sets the logs folder.
public const string LogsArg = "-logs"
Field Value
SavesArg
Sets the saves folder.
public const string SavesArg = "-saves"
Field Value
Methods
ApplyPackageArguments(ServerSettings, IReadOnlyList<string>)
Applies the package arguments (-healthport -admin -logs -saves) to settings.
public static IReadOnlyList<string> ApplyPackageArguments(ServerSettings settings, IReadOnlyList<string> args)
Parameters
settingsServerSettingsargsIReadOnlyList<string>
Returns
- IReadOnlyList<string>
One message per argument with a missing or unreadable value.
Exceptions
- ArgumentNullException
settingsorargsis null.
Load(NetConfig, IReadOnlyList<string>, string, Func<string, string>, Func<string, string>)
Applies every layer to config and returns the package settings with what went wrong.
public static ServerStartupResult Load(NetConfig config, IReadOnlyList<string> args, string packageDirectory, Func<string, string> environment = null, Func<string, string> readFile = null)
Parameters
configNetConfigThe session settings to fill (the game's defaults, from the scene's NetBootstrap).
argsIReadOnlyList<string>The process command line.
packageDirectorystringThe package folder (where the executable and
server.jsonare).environmentFunc<string, string>Reads an environment variable (null when unset); null reads the process environment.
readFileFunc<string, string>Reads a file's text, or null when it does not exist; null reads the disk.
Returns
Exceptions
- ArgumentNullException
config,argsorpackageDirectoryis null.