Skip to content

Quick start with Netcode for GameObjects

This page takes you from a project with Intrigues to two copies of your game that play together over Netcode for GameObjects (NGO). You add one component. You run two editor commands. Then you start a host and a client.

  • Your game scene has an Intrigue Manager with a database assigned. Check Project reports it as a problem when the database is missing.
  • NGO (com.unity.netcode.gameobjects) is installed from the Package Manager.
  • Both sides will use the same database, the same scenes, and the same version of Intrigues and of the add-on.
The Multiplayer add-on compiles on Unity 6000.0 and 6000.6. Two players were tested on 6000.0 (an editor host and a development player); not yet on 6000.6, over Relay or with IL2CPP.
  1. In your menu scene, add a NetworkManager with a UnityTransport, turn Enable Scene Management off in its settings because Intrigues loads the game scene on each player’s machine itself, and leave the Player Prefab empty, because a player plays a character, not a prefab.
  2. Put the component Intrigues / Multiplayer / Netcode Session on the NetworkManager’s object. In code it is the class NetcodeSessionStarter, in the namespace MrW.Intrigues.Multiplayer.Netcode. It adds a MultiplayerDriver to the scene when there is none.
  3. Call StartHost() from your Host button and StartClient() from your Join button. Set the address, port, password and wanted character on the component first. To try it quickly, set Start On Play to Host or Client instead.
  4. Choose Tools > MrW > Intrigues > Multiplayer > Check Project. It opens the Session window on its Checks tab and lists what is missing or wrong, with one-click fixes for the simple things.
  5. Choose Tools > MrW > Intrigues > Multiplayer > Build Asset Table once. The table lists the assets that may be named between machines. It is made at Assets/Intrigues Multiplayer Asset Table.asset when the project has none, and a build step rebuilds it before every player build unless you turn that off on the table.
  6. Make a build for each machine, or open a second editor on a copy of the project. Start one as host and the others as players.

Example, not compiled. It uses only the member names read from NetcodeSessionStarter.cs.

using MrW.Intrigues.Multiplayer.Netcode;
using UnityEngine;
public class MenuButtons : MonoBehaviour
{
public NetcodeSessionStarter session;
public void OnHostPressed() => session.StartHost();
public void OnJoinPressed()
{
session.address = "127.0.0.1";
session.port = 7777;
session.wantedActorId = "your-actor-id"; // an actor ID from your database
session.StartClient();
}
}

Both methods return false when the session does not start. The console says why.

Field What it does
address, port Where a client connects. The defaults are 127.0.0.1 and 7777.
listenAddress Where the host listens. Empty means every IPv4 interface (0.0.0.0).
startOnPlay None, Host or Client, done when the component starts. It waits up to 30 seconds for an Intrigue Manager.
maxPlayers Remote players at most. The default is 7.
hostPassword, password The password a host asks for and a client gives. Empty means none.
scene The game scene clients load. Empty means the host’s active scene.
serverOnly NGO starts a server, not a host (no NGO client on this machine). It does not make a dedicated host: the session is hosted with Dedicated off and 7 remote seats.
wantedActorId The actor a new player wants to play. A new player must name one the host knows, or the host refuses the join.
rejoinWithLastKey On by default. A later Start Client to the same host takes the same seat back with the key that host gave.

With Read Command Line on (the default), a built player reads these:

Switch Effect
-intriguesHost / -intriguesClient Host or join when the component starts.
-intriguesAddress 1.2.3.4 The address.
-intriguesPort 7777 The port.
-intriguesActor <actor ID> The wanted character.
-intriguesPassword <text> The password, for host and client. It shows in the machine’s process list.

Choose Tools > MrW > Intrigues > Multiplayer > Build Two-Player Sample. It builds a small game in a Generated folder and adds two scenes to your Build Settings. Open Two-Player Menu, host in one copy and join in the other, using 127.0.0.1 on the same machine. Then press Propose an Alliance: the other player answers in a dialogue.

The builder refuses while an open scene has unsaved changes. The sample needs Input Handling set to Input Manager (Old) or Both. A build starts with the first scene of the Build Settings, so move Two-Player Menu to the top or untick the others.

What you see What to do
Nothing happens on join. Run Check Project. The usual causes are NGO’s scene management left on, a missing database on the Intrigue Manager, and a game scene that is not in the Build Settings.
Netcode logs “Incomplete connection request”. Connection Approval is off on a NetworkManager your game starts itself. Turn it on. The Intrigues starter turns it on for you.
The join is refused with “The versions differ: …” or “This machine’s game content (database or scene) differs from the host’s.” The versions, databases, asset table or scenes differ. Make the same build for everybody and rebuild the asset table.

More settings are in the Settings reference, and the editor windows are in Multiplayer tools and troubleshooting.