Last updated
Last updated
One of the first steps in adding coherence to a project is to setup the scene that you want the networking to happen in.
The topics of this page are covered in the first minute of this video:
Preparing a scene for network synchronization requires to add three fundamental objects:
In the top menu: coherence > Scene Setup > Create CoherenceBridge
A GameObject with a CoherenceBridge
script will be created.
No particular setup is required now, but feel free to explore the options in its Inspector.
In the top menu: coherence > Scene Setup > Create LiveQuery
A GameObject with a LiveQuery
script will be created.
For a big game world, it makes sense to use a small range and parent the LiveQuery to the player character or the camera, so it can move with it. But for now, let's just create a LiveQuery, position it at the centre of the world, and keep it as Infinite (no spatial constraints).
While LiveQueries are an optimisation tool, having at least one LiveQuery is necessary.
In the top menu: coherence > Explore Samples
From the Explore Samples menu, choose Connect Dialog: Rooms. The Prefab will be instantiated in your scene.
In this section, we:
Added an in-game UI to allow players to connect over the network
This object manages the connection with coherence's relay, the , and is the centre of many connection-related events.
A defines what part of the world the Client is interested in when requesting data from the Replication Server. When Constrained, it covers limited volume. The Extent property specifies how far it reaches. Anything that is outside the area defined by the LiveQuery will not be synced.
A Connect dialog UI provides an interface for the player to connect to the Replication Server, once the game is running. You can create your own connection dialog, but we provide a few examples as a quick way to get started and for prototyping. Read more in the section dedicated to .
Added a to the scene to facilitate connection to the
Used a to ensure we receive network updates
Next: time to !