1. Transforms
Last updated
Last updated
Welcome to the first scene of the coherence Network Playground. This scene will show you how easy it is to set up networking in your Unity project and sync GameObject transforms across the network.
In this example, each Client will have a player character to move by clicking on the map to make the Entity move to that location. Each Client will only have control of its local Entity.
In the Hierarchy of the Scene you can see three core Prefabs.
Core Scene Setup
and Coherence Setup
are present in all (Network Playground) Scenes and described in detail on Start Tutorial page.
Coherence Entity Character
is the Prefab that will change per Scene with different functionality. It has a standard CharacterController
and Rigidbody
as well as an Agent
script which will handle movement through the Input Manager
in the Core Scene Setup
Prefab.
Coherence Entity Character
(remember to always change the Prefab, not the instance) is located in the Resources folder. The UnityEngine.Transform
and position
are ticked to sync. All other settings (persistence and authority) use the default settings. This Entity will be session-based, no authority handover and no adoption will take place, when a Client leaves.
The On Network Instantiation
event is used to change the color of the mesh and recalculate the RigidBody collisions. That's it.
You can build this scene via the Build Settings. Run the local Replication Server through the Window > Coherence > Settings window and see how it works. You can try running multiple Clients rather than just two and see how the replication works for each of them.