Quickstart
The goal of this section is to be short, easy to follow, and closer to a tutorial than reference documentation. If you follow the instructions on this page, you will have an example server and client running in Unity and talking to each other. You will also see how to add your first networked object and call your first RPC.
Download Projects
Download the latest version of the Client and Server Unity
projects. Each project already includes the networking scripts
(UCNetwork, ClientNetwork, ServerNetwork, and
NetworkSync).
Running the Server
Open the Server project in Unity.
Load the scene named Server.
Hit Play.
The server starts automatically on port 603 (the area code for New Hampshire). By default, all connection requests are automatically approved.
Running the Client
Open the Client project in Unity.
Load the scene named Client.
Hit Play.
Connecting to the Server
The client UI allows you to enter an IP address and port.
If you are running the server locally, use:
IP Address:
127.0.0.1Port:
603
Once connected:
The server approves the connection.
The client is placed into Area 1 by default (see areas).
The client spawns a networked
Playerobject and adds it to Area 1.
To test multiple players, build the Client project and run the executable outside of the Unity editor while leaving the editor client running.
Your First Networked Object
Let’s make a new networked prefab that spawns across all clients.
In the Client project, create a prefab called
Cube.Place it in a
Resources/folder.Add a
NetworkSynccomponent to the prefab.In any client script, call:
void Update() { if (Input.GetKeyDown(KeyCode.Space)) { clientNetwork.Instantiate("Cube", new Vector3(0, 1, 0), Quaternion.identity); } }
Now, whenever you press Space, a cube appears on all connected clients, synchronized through the server.
Your First RPC
RPCs let you call methods on remote machines like local functions.
Add a method to your Cube script:
public void ChangeColor() { GetComponent<Renderer>().material.color = new Color(Random.value, Random.value, Random.value); }
Trigger it with an RPC:
void Update() { if (Input.GetKeyDown(KeyCode.C)) { networkSync.CallRPC("ChangeColor", UCNetwork.MessageReceiver.AllClientsInArea); } }
Pressing C tells the server to broadcast the ChangeColor RPC to
all clients in the same area. All cubes change color at once.
Creating a Custom Server
To go beyond the default server:
Implement your own connection approval logic (passwords, tokens, account IDs).
Use areas to organize players (towns, dungeons, teams).
Decide when to spawn objects on behalf of clients vs. the server.
Enforce validation: never trust client RPCs or Sync messages without checking ownership and state.
Example:
void ConnectionRequest(ServerNetwork.ConnectionRequestInfo info)
{
if (info.password == "letmein")
server.ConnectionApproved(info.id);
else
server.ConnectionDenied(info.id);
}
Creating a Custom Client
To build your own client gameplay logic:
Instantiate prefabs using
ClientNetwork.Instantiate.Add
NetworkSyncto every networked prefab.Handle ownership with
OnGainOwnership/OnLoseOwnership.Use RPCs for discrete actions (shooting, opening doors).
Use Sync/LiteSync for continuous data (movement, stats).
Example:
void OnGainOwnership()
{
// Enable player controls when we own this avatar
GetComponent<PlayerController>().enabled = true;
}
void OnLoseOwnership()
{
// Disable controls when no longer the owner
GetComponent<PlayerController>().enabled = false;
}
Where to Go Next
Learn more about networked-objects for continuous synchronization.
Explore rpcs for discrete actions.
Use areas to filter updates for scalability.
See server-best-practices and client-best-practices for production-ready patterns.
Summary
Open the Server scene, press Play → server is running.
Open the Client scene, press Play → connect to server on port 603.
Clients spawn a
Playerobject into Area 1 by default.Use
Instantiateto create shared objects,RPCsfor events, andSyncfor continuous updates.Extend by writing custom server logic and client behaviors.