Build and run

Now we can build the project and try out network replication locally.

This example will show you how to launch a local replication server and connect multiple instances.

Running a Replication Server Locally

You can run a local replication server from the coherence menu by clicking:

coherence -> Server -> Run Local Worlds Server.

This will open a new terminal window with the replication server and world created in it.

Build and Connect

Fresh projects require to bake at least once to generate reflection mode support (and generate a valid Schema ID).

Now it's time to make a standalone build and test network replication.

#protip: Go to Project Settings, Player and change the Fullscreen Mode to Windowed and enable Resizable Window. This will make it much easier to observe standalone builds side-by-side when testing networking.

Note, that for this sample we are running World on server, so make sure that Connect Dialog Selector in your Coherence Sample UI object on scene is set to Worlds also.

Open the Build Settings window (File -> Build Settings). Click on Add Open Scenes to add the current scene to the build. Click Build and Run.

Select a folder (e.g. builds) and click OK.

When the build is done, start another instance of the executable (or run the project in the Game Window in Unity).

Click Connect on both clients. Now try focusing one and using WSAD keys. You will see the box move on the other side as well.

Congratulations, you've made your first coherence replicated experience. But this is only the beginning. Keep reading to take advantage of more advanced coherence features.

Connect across the local network

If you want to connect to the local replication server from another local device (such as another PC, Mac, Mobile or VR device), you can find your IPv4 address and use that as your server address in the Connect dialog. These devices need to be connected to the same network.

You can find your IPv4 address by going to your command line tool and type ipconfig . Remember to include the port number, for example 192.168.1.185:32001.

Make sure your Firewall allows remote connections to connect to the replication server from other devices on your network.

Last updated