Unity Networking works with Unity 5.5 up to 2018.4.
In the Humanoid Preferences you can select which networking package you want to use. Go to Edit Menu->Preferences->Humanoid->Networking Support and select the desired networking package.
For the configuration we have two options: Cloud Server and Own Server.
Warning: the standard free Unity Networking Service is very limited in its bandwidth. With more two players and a high send rate, you will soon see disconnects. These disconnects happen if the bandwidth limit of the Unity Networking Service is exceeded. For this reason we advise to the a paid service for Unity Networking using the Cloud Server or to use your Own Server.
In this option you will use a server in the cloud, provided and hosted by a third party like Unity or Photon.
In the Cloud server option you can specify the following parameters:
|Room Name||The name of the environment shared by the players.|
|Game Version||The version of the environment shared by the players.|
When using your own server, you have two major options:
- Use different builds for the Host and the Client. In this case, do not Use Role File.
- Use a single build for all uses. In this case you need to select Use Role File.
Using different builds for Host and Client
Ensure that Use Role File is disabled. You will have the following options:
Ensure that the Server IP Address is set to the IP address of the Host. Then you can make a build for the Host with the Role setting on Host. When this build is completed, you can switch the Role to Client and make the build for the client.
Using a single build for the Host and Client
With this option a Role.txt file is used by the bulld to determine whether it should run as Host or Client. It also defined the IP address of the Host so that it can be changed easily without making a new build.
|Role File Name||The filename of the role file. This file should be located in the Assets/StreamingAssets/ folder in your project.|
|Server IP Address||The IP address of the host which will be written into the role file.|
|Set Role in File||These buttons will create or overwrite the role file in Assets/StreamingAssets/ folder using the Role File Name. The Server IP Address and the chosen button will deteremine the contents of this file. The file van be edited manually afterwards.|
The Role File Format
The role file is has a very basic 2-line format.
Line 1: ‘Host’ or ‘Client’ depending on the desired running mode
Line 2: The IP address of the host.