Server.json
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.
The server.json
file is a file that has variable data, such as the current allocation ID, for each server. It’s automatically generated and populated for each server based on the configuration variables and the server data. It has all the built-in configuration variables and any custom values from your build configuration variables.
The server.json
file exists within each server’s server ID directory. By default, it has all the built-in configuration variables, such as the allocation ID supplied by your matchmaker, and the connection port. But you can also add any number of configuration variables to track in the build configuration settings.
Here’s an example of what a server.json
file might look like when populated with the configuration variables from a server:
{
"ipv6": "::1",
"port": "9000",
"allocatedUUID": "1a04a1ac-a31a-11ed-a5e3-00155d4f1a62",
"serverID": "12345",
"machineID": "6789",
"fleetID": "c0a3e2a1-6955-415c-b1d4-af9199833e6a",
"regionID": "f15a6c27-de2a-4848-abc3-9579fbfd2259",
"regionName": "North America",
"queryPort": "9010",
"ip": "127.0.0.1",
"queryType": "sqp",
"serverLogDir": "/mnt/unity/logs/"
}
allocatedID
The allocatedID
variable is a special built-in configuration variable that changes each time a server is allocated or unallocated. When a server is allocated, the allocatedUUID
field has the server’s allocation ID. When a server is unallocated, the allocatedUUID
field has an empty string.
Note: Other configuration variables keep their value despite the server allocation status.
Here’s an example of a server.json
file of an allocated server:
{
"ipv6": "::1",
"port": "9000",
"allocatedUUID": "1a04a1ac-a31a-11ed-a5e3-00155d4f1a62",
"serverID": "12345",
"machineID": "6789",
"fleetID": "c0a3e2a1-6955-415c-b1d4-af9199833e6a",
"regionID": "f15a6c27-de2a-4848-abc3-9579fbfd2259",
"regionName": "North America",
"queryPort": "9010",
"ip": "127.0.0.1",
"queryType": "sqp",
"serverLogDir": "/mnt/unity/logs/"
}
Here’s an example of a server.json
file of an unallocated server:
{
"ipv6": "::1",
"port": "9000",
"allocatedUUID": "",
"serverID": "12345",
"machineID": "6789",
"fleetID": "c0a3e2a1-6955-415c-b1d4-af9199833e6a",
"regionID": "f15a6c27-de2a-4848-abc3-9579fbfd2259",
"regionName": "North America",
"queryPort": "9010",
"ip": "127.0.0.1",
"queryType": "sqp",
"serverLogDir": "/mnt/unity/logs/"
}
You can track the allocation ID of a server by monitoring the server.json
for changes. To detect changes, set up an event trigger that detects file changes or a process to check the file for changes at a regular interval. It’s best practice to use an event trigger because the interval check causes unnecessary resource usage.
File location
The server.json
file is available on disk in the following location:
- For Linux, it's in the
$HOME
environment variable. For example$HOME/server.json
.