3. Test your game locally
Last updated
Last updated
Now we can build the project and try out network replication locally. To do so, we need to launch and connect to a Replication Server.
You can run a local Replication Server directly on your machine! You can either:
Go to: coherence > Local Replication Server > Run for Rooms or Run for Worlds
In the coherence Hub, open the Replication Servers tab. From here, you can run a server for Rooms or Worlds:
Whether you run a Replication Server for Rooms or for Worlds depends on which setup you plan to use, which in turn requires the correct corresponding Sample UI.
Regardless of how you launch it, a new terminal window will open and display the running Replication Server:
If the console opens correctly and you don't see an error line (they show up in red), it means your Replication Server is running! Now you should be able to connect to it, in the game.
It is often useful to be able to run multiple instances of your game on the same device. This allows you to simulate multiple player connections.
There are multiple ways to do this:
Make a build of the game
Use the Multiplayer Play Mode package (recommended, only available in Unity 6)
Use a third-party plugin, such as ParrelSync
Dive into the individual pages to see our recommendation for each option.
Connecting is done using our API. For now, use one of the Sample UIs we provide. You should already have one in the scene if you followed the steps in the Scene Setup section.
With the game and the RS running, you can now connect and play the game.
If you can't connect
Did you change something in the configuration of your connected Prefabs? You have to bake again, and restart the Replication Server.
Time to bake!
In this section, we:
Ran a local Replication Server
Saw how to run multiple instances of the game
Connected to the Replication Server
Now that we know things work locally, it's time to test the game in the coherence Cloud!
You will notice it because there will be a little chef's hat next to the coherence folder, or a warning sign on Bake buttons: