<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mindattic.com/wiki/docs/index.php?action=history&amp;feed=atom&amp;title=Unity.Multiplayer%2Farticles%2Fgetting-started</id>
	<title>Unity.Multiplayer/articles/getting-started - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mindattic.com/wiki/docs/index.php?action=history&amp;feed=atom&amp;title=Unity.Multiplayer%2Farticles%2Fgetting-started"/>
	<link rel="alternate" type="text/html" href="https://mindattic.com/wiki/docs/index.php?title=Unity.Multiplayer/articles/getting-started&amp;action=history"/>
	<updated>2026-12-05T02:20:10Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.3</generator>
	<entry>
		<id>https://mindattic.com/wiki/docs/index.php?title=Unity.Multiplayer/articles/getting-started&amp;diff=910&amp;oldid=prev</id>
		<title>Docs Sync: md2wiki: sync from MindAttic.Docs</title>
		<link rel="alternate" type="text/html" href="https://mindattic.com/wiki/docs/index.php?title=Unity.Multiplayer/articles/getting-started&amp;diff=910&amp;oldid=prev"/>
		<updated>2026-11-29T20:36:38Z</updated>

		<summary type="html">&lt;p&gt;md2wiki: sync from MindAttic.Docs&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Getting started: a new multiplayer game in minutes =&lt;br /&gt;
&lt;br /&gt;
By the end of this page you have a brand-new Unity project that is a working multiplayer game. It has a main menu with Host, Join by IP and Join by code, a lobby with a join code and the roster, reconnect, an in-game menu, players drawn in their own name and colour, objects found by key, a restart vote, a bot, EditMode and PlayMode tests, a dedicated server running on your PC, and an end-to-end smoke test with two bots. You write no code to get there; then you replace the template&amp;#039;s game with yours.&lt;br /&gt;
&lt;br /&gt;
It uses the [[Unity.Multiplayer/articles/kit|kit]]: Unity.Multiplayer (this package), MindAttic Components (the menus) and Unity.Shared (the player&amp;#039;s profile). Every command below can be pasted as is.&lt;br /&gt;
&lt;br /&gt;
== What you need ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;strong&amp;gt;Unity 6000.4.3f1&amp;lt;/strong&amp;gt;, with &amp;lt;strong&amp;gt;Linux Build Support (Mono)&amp;lt;/strong&amp;gt; if you want to run servers and bots in Docker.&lt;br /&gt;
* &amp;lt;strong&amp;gt;Git&amp;lt;/strong&amp;gt;, and the &amp;lt;strong&amp;gt;.NET 10 SDK&amp;lt;/strong&amp;gt; for the &amp;lt;code&amp;gt;mp-host&amp;lt;/code&amp;gt; tool.&lt;br /&gt;
* &amp;lt;strong&amp;gt;Docker&amp;lt;/strong&amp;gt; (Docker Desktop on Windows) for the local server and the smoke test. Not needed to play in the editor.&lt;br /&gt;
&lt;br /&gt;
== 1. Get the kit (1 minute) ==&lt;br /&gt;
&lt;br /&gt;
The three packages are used by &amp;lt;code&amp;gt;file:&amp;lt;/code&amp;gt; path, so clone their repos side by side. Your game goes in the same folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;md-code lang-powershell&amp;quot;&amp;gt;mkdir C:\Games; cd C:\Games&lt;br /&gt;
git clone https&amp;amp;#58;//github.com/mindattic/Unity.Multiplayer&lt;br /&gt;
git clone https&amp;amp;#58;//github.com/mindattic/MindAttic.Components&lt;br /&gt;
git clone https&amp;amp;#58;//github.com/mindattic/Unity.Shared&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 2. Make a Unity project beside them (2 minutes) ==&lt;br /&gt;
&lt;br /&gt;
In Unity Hub, click &amp;lt;strong&amp;gt;New project&amp;lt;/strong&amp;gt;, pick &amp;lt;strong&amp;gt;Unity 6000.4.3f1&amp;lt;/strong&amp;gt; and any template (&amp;lt;strong&amp;gt;Universal 2D&amp;lt;/strong&amp;gt; is a good start), name it &amp;lt;code&amp;gt;SpaceCrates&amp;lt;/code&amp;gt; and put it in &amp;lt;code&amp;gt;C:\Games&amp;lt;/code&amp;gt;. Or from a terminal:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;md-code lang-powershell&amp;quot;&amp;gt;&amp;amp; &amp;quot;C:\Program Files\Unity\Hub\Editor\6000.4.3f1\Editor\Unity.exe&amp;quot; -batchmode -quit -createProject C:\Games\SpaceCrates&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Open &amp;lt;code&amp;gt;C:\Games\SpaceCrates\Packages\manifest.json&amp;lt;/code&amp;gt; and add the multiplayer package at the top of &amp;lt;code&amp;gt;&amp;quot;dependencies&amp;quot;&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;md-code lang-json&amp;quot;&amp;gt;{&lt;br /&gt;
  &amp;quot;dependencies&amp;quot;: {&lt;br /&gt;
    &amp;quot;com.mindattic.unity.multiplayer&amp;quot;: &amp;quot;file:../../Unity.Multiplayer/unity/com.mindattic.unity.multiplayer&amp;quot;,&lt;br /&gt;
    ...&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The package pulls in Netcode for GameObjects 2.x and Unity Transport 2.x, and that one line is enough to compile and run (batch mode included). The package&amp;#039;s test kit (&amp;lt;code&amp;gt;Unity.Multiplayer.Testing&amp;lt;/code&amp;gt;) builds on NGO&amp;#039;s test helpers, so it only compiles once you list NGO under &amp;lt;code&amp;gt;&amp;quot;testables&amp;quot;&amp;lt;/code&amp;gt;, which the wizard in step 3 does for you; until then the kit is simply absent. Open the project in the editor.&lt;br /&gt;
&lt;br /&gt;
== 3. Run the New Game wizard (1 minute) ==&lt;br /&gt;
&lt;br /&gt;
Click &amp;lt;strong&amp;gt;MindAttic ▸ Multiplayer ▸ New Game…&amp;lt;/strong&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;strong&amp;gt;Packages.&amp;lt;/strong&amp;gt; The window checks &amp;lt;code&amp;gt;Packages/manifest.json&amp;lt;/code&amp;gt; and lists exactly the lines it lacks: MindAttic Components, Unity.Shared (optional), the Unity Test Framework if the project template left it out, and &amp;lt;code&amp;gt;com.unity.netcode.gameobjects&amp;lt;/code&amp;gt; under &amp;lt;code&amp;gt;&amp;quot;testables&amp;quot;&amp;lt;/code&amp;gt; if you skipped it. Click &amp;lt;strong&amp;gt;Add missing lines to Packages/manifest.json&amp;lt;/strong&amp;gt;. It writes the &amp;lt;code&amp;gt;file:&amp;lt;/code&amp;gt; paths to the repos it finds beside Unity.Multiplayer, and Unity imports them. If a repo is somewhere else, the window shows the line with the documented path for you to fix by hand, and never writes a path that does not exist. The lines it adds look like this:&amp;lt;br&amp;gt;&amp;lt;pre class=&amp;quot;md-code lang-json&amp;quot;&amp;gt;&amp;quot;com.mindattic.components.unity&amp;quot;: &amp;quot;file:../../MindAttic.Components/unity/com.mindattic.components.unity&amp;quot;, &amp;quot;com.mindattic.unity.shared&amp;quot;: &amp;quot;file:../../Unity.Shared/unity/com.mindattic.unity.shared&amp;quot;, &amp;quot;com.unity.test-framework&amp;quot;: &amp;quot;1.6.0&amp;quot;, ... &amp;quot;testables&amp;quot;: [ &amp;quot;com.unity.netcode.gameobjects&amp;quot; ]&amp;lt;/pre&amp;gt;&lt;br /&gt;
# &amp;lt;strong&amp;gt;Your game.&amp;lt;/strong&amp;gt; Type a name (&amp;lt;code&amp;gt;SpaceCrates&amp;lt;/code&amp;gt;) and click &amp;lt;strong&amp;gt;Create game&amp;lt;/strong&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The wizard copies the game template into &amp;lt;code&amp;gt;Assets/SpaceCrates&amp;lt;/code&amp;gt;, with &amp;lt;code&amp;gt;SpaceCrates&amp;lt;/code&amp;gt; as its namespace and assembly names and fresh asset GUIDs. It also:&lt;br /&gt;
&lt;br /&gt;
* puts &amp;lt;code&amp;gt;Assets/SpaceCrates/Game.unity&amp;lt;/code&amp;gt; first in Build Settings,&lt;br /&gt;
* turns on &amp;lt;strong&amp;gt;Run In Background&amp;lt;/strong&amp;gt;,&lt;br /&gt;
* makes sure &amp;lt;strong&amp;gt;Player Settings &amp;gt; Scripting Define Symbols&amp;lt;/strong&amp;gt; holds &amp;lt;code&amp;gt;MINDATTIC_NGO_TESTABLE&amp;lt;/code&amp;gt;, the switch for the test kit (the package&amp;#039;s editor script sets it while NGO is under &amp;lt;code&amp;gt;&amp;quot;testables&amp;quot;&amp;lt;/code&amp;gt;). &amp;lt;strong&amp;gt;Commit &amp;lt;code&amp;gt;ProjectSettings/ProjectSettings.asset&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;Packages/manifest.json&amp;lt;/code&amp;gt; and the game:&amp;lt;/strong&amp;gt; the game&amp;#039;s test assemblies carry the same symbol as a define constraint, so without the committed define a clean checkout (CI, a deploy build) compiles without the tests and then rewrites that file. See [[Unity.Multiplayer/articles/testing#Set up|Testing]], step 3,&lt;br /&gt;
* writes &amp;lt;code&amp;gt;mp-host.json&amp;lt;/code&amp;gt; at the project root, with the server scene and the smoke test&amp;#039;s bots,&lt;br /&gt;
* writes &amp;lt;code&amp;gt;.github/workflows/nightly.yml&amp;lt;/code&amp;gt;, the nightly smoke test,&lt;br /&gt;
* and opens the scene.&lt;br /&gt;
&lt;br /&gt;
The same thing runs in batch mode, for scripts and CI:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;md-code lang-powershell&amp;quot;&amp;gt;Unity.exe -batchmode -projectPath C:\Games\SpaceCrates -executeMethod Unity.Multiplayer.Editor.NewGame.CreateFromCommandLine -addPackages&lt;br /&gt;
Unity.exe -batchmode -projectPath C:\Games\SpaceCrates -executeMethod Unity.Multiplayer.Editor.NewGame.CreateFromCommandLine -gameName SpaceCrates&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The first adds the manifest lines. The second creates the game, or exits with code 2 and prints the missing lines.&lt;br /&gt;
&lt;br /&gt;
== 4. Play (2 minutes) ==&lt;br /&gt;
&lt;br /&gt;
Press &amp;lt;strong&amp;gt;Play&amp;lt;/strong&amp;gt; and click &amp;lt;strong&amp;gt;Host&amp;lt;/strong&amp;gt;. The lobby shows a join code (or your LAN address when no code service is set up) and the players. Click &amp;lt;strong&amp;gt;Start&amp;lt;/strong&amp;gt;. Move your square with the arrow keys or WASD, and walk into a crate to push it. &amp;lt;strong&amp;gt;Esc&amp;lt;/strong&amp;gt; opens the in-game menu: &amp;lt;strong&amp;gt;Invite players&amp;lt;/strong&amp;gt;, &amp;lt;strong&amp;gt;Settings&amp;lt;/strong&amp;gt; (your name and colour), &amp;lt;strong&amp;gt;Vote to restart&amp;lt;/strong&amp;gt;, &amp;lt;strong&amp;gt;End game&amp;lt;/strong&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
A second player needs a second copy of the game:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;strong&amp;gt;Multiplayer Play Mode&amp;lt;/strong&amp;gt; (quickest): install &amp;lt;code&amp;gt;com.unity.multiplayer.playmode&amp;lt;/code&amp;gt;, open &amp;lt;strong&amp;gt;Window ▸ Multiplayer ▸ Multiplayer Play Mode&amp;lt;/strong&amp;gt;, tick &amp;lt;strong&amp;gt;Player 2&amp;lt;/strong&amp;gt; and press Play. Host in one window. In the other, click &amp;lt;strong&amp;gt;Join by IP&amp;lt;/strong&amp;gt; and type &amp;lt;code&amp;gt;127.0.0.1&amp;lt;/code&amp;gt;, or &amp;lt;strong&amp;gt;Join by code&amp;lt;/strong&amp;gt; and type the code.&lt;br /&gt;
* &amp;lt;strong&amp;gt;A build:&amp;lt;/strong&amp;gt; &amp;lt;strong&amp;gt;File ▸ Build And Run&amp;lt;/strong&amp;gt;. Host in the editor and join from the build, or the reverse.&lt;br /&gt;
&lt;br /&gt;
Now try the edges. Rename yourself in Settings mid-game: every peer&amp;#039;s label changes. Vote to restart: the other player gets Yes / No, and the crates go back to their starts once two thirds say Yes. Close a client and rejoin within 60 seconds: you get your seat back ([[Unity.Multiplayer/articles/reconnect-seats|Reconnect and seats]]).&lt;br /&gt;
&lt;br /&gt;
== 5. What you got: the tour ==&lt;br /&gt;
&lt;br /&gt;
Everything in &amp;lt;code&amp;gt;Assets/SpaceCrates&amp;lt;/code&amp;gt; is yours to change. Its &amp;lt;code&amp;gt;README.md&amp;lt;/code&amp;gt; lists every file; these are the ones to read first.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;The scene.&amp;lt;/strong&amp;gt; &amp;lt;code&amp;gt;Game.unity&amp;lt;/code&amp;gt; has one &amp;lt;code&amp;gt;NetworkManager&amp;lt;/code&amp;gt; GameObject holding Unity Transport and three of the kit&amp;#039;s components:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;strong&amp;gt;&amp;lt;code&amp;gt;NetBootstrap&amp;lt;/code&amp;gt;&amp;lt;/strong&amp;gt; owns the session. A headless launch serves by itself, &amp;lt;code&amp;gt;-mode&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;-port&amp;lt;/code&amp;gt; and the rest of the launch line retarget it, and it reads the server package&amp;#039;s &amp;lt;code&amp;gt;server.json&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;strong&amp;gt;&amp;lt;code&amp;gt;NetFrontEnd&amp;lt;/code&amp;gt;&amp;lt;/strong&amp;gt; is every menu and dialog.&lt;br /&gt;
* &amp;lt;strong&amp;gt;&amp;lt;code&amp;gt;NetVotes&amp;lt;/code&amp;gt;&amp;lt;/strong&amp;gt; spawns the vote board and gives the front end its vote overlay.&lt;br /&gt;
&lt;br /&gt;
The Player Prefab is &amp;lt;code&amp;gt;Resources/Game/Player.prefab&amp;lt;/code&amp;gt;. A &amp;lt;code&amp;gt;Game&amp;lt;/code&amp;gt; object holds &amp;lt;code&amp;gt;Game.cs&amp;lt;/code&amp;gt;. Players, the dedicated server and bots all run this one scene.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;The player&amp;lt;/strong&amp;gt; (&amp;lt;code&amp;gt;Runtime/Player.cs&amp;lt;/code&amp;gt;):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;md-code lang-csharp&amp;quot;&amp;gt;public partial class Player : NetEntity&lt;br /&gt;
{&lt;br /&gt;
    [ToServer(RateLimit = 20)]&lt;br /&gt;
    public partial void Move(Vector2 direction);   // the owner calls it; the server runs OnMove&lt;br /&gt;
&lt;br /&gt;
    [Synced] private Vector2 _position;            // the server writes Position; every peer reads it&lt;br /&gt;
&lt;br /&gt;
    private void OnMove(Vector2 direction) =&amp;gt; _direction = Vector2.ClampMagnitude(direction, 1f);&lt;br /&gt;
&lt;br /&gt;
    public string DisplayName =&amp;gt; Roster(out NetPlayer p) ? p.DisplayName : &amp;quot;Player&amp;quot;;   // from NetRoster&lt;br /&gt;
    public Color32 Color =&amp;gt; Roster(out NetPlayer p) ? p.UnityColor() : new Color32(255, 255, 255, 255);&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The server owns the game state, and clients send what they want to happen; that is the one rule the whole package is built on ([[Unity.Multiplayer/BIBLE#UM-LAW-1 — The server owns state|UM-LAW-1]]). The class is &amp;lt;code&amp;gt;partial&amp;lt;/code&amp;gt; because the package&amp;#039;s source generator writes the other half. Names and colours are not copied onto the player: they come from the session&amp;#039;s [[Unity.Multiplayer/articles/players|roster]], so a rename shows everywhere at once. See [[Unity.Multiplayer/articles/attributes|Attributes reference]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Keyed objects&amp;lt;/strong&amp;gt; (&amp;lt;code&amp;gt;Runtime/Crate.cs&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Runtime/Arena.cs&amp;lt;/code&amp;gt;). The crate prefab has a &amp;lt;code&amp;gt;NetKey&amp;lt;/code&amp;gt;. The server spawns &amp;lt;code&amp;gt;crate:0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;crate:1&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;crate:2&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;session.Objects.Spawn(prefab, key, position)&amp;lt;/code&amp;gt;, and any peer finds one by its key, not by spawn order:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;md-code lang-csharp&amp;quot;&amp;gt;if (session.Objects.TryGet(&amp;quot;crate:0&amp;quot;, out Crate crate)) Debug.Log(crate.Position);&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [[Unity.Multiplayer/articles/objects|Networked objects by key]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Server rules and a vote&amp;lt;/strong&amp;gt; (&amp;lt;code&amp;gt;Runtime/Arena.cs&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Runtime/Game.cs&amp;lt;/code&amp;gt;). &amp;lt;code&amp;gt;Arena&amp;lt;/code&amp;gt; is a plain class. &amp;lt;code&amp;gt;Arena.Serve(session, cratePrefab)&amp;lt;/code&amp;gt; spawns the crates whenever the session runs as a server, and its restart &amp;lt;code&amp;gt;VoteKind&amp;lt;/code&amp;gt; despawns them and spawns them again under the same keys. &amp;lt;code&amp;gt;Game.cs&amp;lt;/code&amp;gt; registers that vote and adds the game&amp;#039;s items to the front end:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;md-code lang-csharp&amp;quot;&amp;gt;NetVotes.Instance.AddKind(_arena.CreateRestartVote());&lt;br /&gt;
frontEnd.AddScreen(&amp;quot;How to play&amp;quot;, s =&amp;gt; s.AddText(&amp;quot;Move with the arrow keys or WASD.&amp;quot;), MenuPlacement.Both);&lt;br /&gt;
frontEnd.AddPauseMenuItems(s =&amp;gt; s.AddButton(&amp;quot;Vote to restart&amp;quot;, () =&amp;gt; NetVotes.Instance.Board.StartVote(&amp;quot;restart&amp;quot;)));&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [[Unity.Multiplayer/articles/votes|Votes]] and [[Unity.Multiplayer/articles/front-end|Drop-in front end]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;The bot&amp;lt;/strong&amp;gt; (&amp;lt;code&amp;gt;Runtime/GameBot.cs&amp;lt;/code&amp;gt;). A &amp;lt;code&amp;gt;[NetBotDriver]&amp;lt;/code&amp;gt; &amp;lt;code&amp;gt;IBotDriver&amp;lt;/code&amp;gt;. Launched with &amp;lt;code&amp;gt;-bot A&amp;lt;/code&amp;gt;, the library joins the game by code with no menus and calls &amp;lt;code&amp;gt;RunAsync&amp;lt;/code&amp;gt;. The bot walks to its crate with the same &amp;lt;code&amp;gt;Move&amp;lt;/code&amp;gt; calls a player makes, pushes the crate, and calls &amp;lt;code&amp;gt;bot.Pass(...)&amp;lt;/code&amp;gt; once the server has moved it. See [[Unity.Multiplayer/articles/bots|Bots]].&lt;br /&gt;
&lt;br /&gt;
== 6. Run the tests (2 minutes) ==&lt;br /&gt;
&lt;br /&gt;
Open &amp;lt;strong&amp;gt;Window ▸ General ▸ Test Runner&amp;lt;/strong&amp;gt;. Under &amp;lt;strong&amp;gt;EditMode&amp;lt;/strong&amp;gt;, &amp;lt;code&amp;gt;SpaceCrates.EditorTests&amp;lt;/code&amp;gt; checks the scene&amp;#039;s kit components and runs the prefab validator. Under &amp;lt;strong&amp;gt;PlayMode&amp;lt;/strong&amp;gt;, &amp;lt;code&amp;gt;SpaceCrates.Tests&amp;lt;/code&amp;gt; runs on the test kit, each test with a real host or dedicated server and real clients on a free loopback port:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;PlayerTests&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;NetSessionTest&amp;lt;/code&amp;gt;): a &amp;lt;code&amp;gt;Move&amp;lt;/code&amp;gt; reaches the server and comes back as a synced position, everyone sees the roster&amp;#039;s name and colour, and the server clamps a cheating client&amp;#039;s input.&lt;br /&gt;
* &amp;lt;code&amp;gt;CrateTests&amp;lt;/code&amp;gt;: every crate is found by key on a client, and a restart vote puts them back.&lt;br /&gt;
* &amp;lt;code&amp;gt;BotTests&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;NetBotTest&amp;lt;/code&amp;gt;): a dedicated server and two &amp;lt;code&amp;gt;GameBot&amp;lt;/code&amp;gt;s join by code through an in-process rendezvous service and each push their crate. This is the nightly smoke test, without Docker.&lt;br /&gt;
&lt;br /&gt;
Or in batch mode:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;md-code lang-powershell&amp;quot;&amp;gt;Unity.exe -batchmode -projectPath C:\Games\SpaceCrates -runTests -testPlatform PlayMode -assemblyNames SpaceCrates.Tests -testResults results.xml&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [[Unity.Multiplayer/articles/testing|Testing]] for the whole kit.&lt;br /&gt;
&lt;br /&gt;
== 7. A server on your PC, then on the internet (5 minutes) ==&lt;br /&gt;
&lt;br /&gt;
Install &amp;lt;code&amp;gt;mp-host&amp;lt;/code&amp;gt;, the kit&amp;#039;s deploy tool, once per machine:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;md-code lang-powershell&amp;quot;&amp;gt;powershell -File C:\Games\Unity.Multiplayer\tools\install-mp-host.ps1&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, from the project folder:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;md-code lang-powershell&amp;quot;&amp;gt;cd C:\Games\SpaceCrates&lt;br /&gt;
mp-host game local            # builds the Linux server and runs it, with a rendezvous service, in Docker on this PC&lt;br /&gt;
mp-host game down             # stops it&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mp-host&amp;lt;/code&amp;gt; finds the editor from &amp;lt;code&amp;gt;ProjectVersion.txt&amp;lt;/code&amp;gt; and the server scene from &amp;lt;code&amp;gt;mp-host.json&amp;lt;/code&amp;gt;. When the server is up it prints the join code; players click &amp;lt;strong&amp;gt;Join by code&amp;lt;/strong&amp;gt;. For a server on the internet, rent any Linux box with Docker and SSH by key (a $4 VPS works), store its login and a GitHub token for the image once (kept in MindAttic.Vault, never in the repo), and deploy. &amp;lt;code&amp;gt;spacecrates&amp;lt;/code&amp;gt; is the server name the wizard put in &amp;lt;code&amp;gt;mp-host.json&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;md-code lang-powershell&amp;quot;&amp;gt;mp-host credentials set-ssh --name spacecrates --host 203.0.113.5 --user root --key $HOME\.ssh\id_ed25519&lt;br /&gt;
mp-host credentials set-ghcr --username &amp;amp;lt;github-user&amp;gt; --token &amp;amp;lt;PAT with write:packages&amp;gt;&lt;br /&gt;
mp-host game deploy --dry-run     # every step, nothing done&lt;br /&gt;
mp-host game deploy               # build, push to GHCR, start on the box, print the join code&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Unity.Multiplayer/articles/hosting|Hosting]] covers the fifteen-plus providers, per-match allocators and updates.&lt;br /&gt;
&lt;br /&gt;
== 8. Bots end to end, and every night (2 minutes) ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;md-code lang-powershell&amp;quot;&amp;gt;mp-host game smoke&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This builds one Linux player and runs it under Docker Compose three ways at once: as the dedicated server, as the rendezvous service, and as two bots (&amp;lt;code&amp;gt;-bot A&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;-bot B&amp;lt;/code&amp;gt;, from &amp;lt;code&amp;gt;mp-host.json&amp;lt;/code&amp;gt;). It exits 0 once both bots have logged &amp;lt;code&amp;gt;&amp;amp;#91;NetBot:A] OK:&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Push the project to GitHub and the &amp;lt;code&amp;gt;nightly.yml&amp;lt;/code&amp;gt; the wizard wrote runs the same smoke test every night. It is one job: &amp;lt;code&amp;gt;uses: mindattic/Unity.Multiplayer/.github/workflows/game-smoke.yml@main&amp;lt;/code&amp;gt;. It needs the Unity license secrets; set them with &amp;lt;code&amp;gt;powershell -File tools\set-ci-secrets.ps1 -Repos mindattic/&amp;amp;lt;YourGame&amp;gt;&amp;lt;/code&amp;gt; (see [[Unity.Multiplayer/articles/ci-secrets|CI secrets]]). See [[Unity.Multiplayer/articles/bots#The nightly workflow|Bots]].&lt;br /&gt;
&lt;br /&gt;
== 9. Make it yours ==&lt;br /&gt;
&lt;br /&gt;
Rename, replace and delete freely. The order most games take:&lt;br /&gt;
&lt;br /&gt;
# Replace the squares (&amp;lt;code&amp;gt;Shapes.cs&amp;lt;/code&amp;gt;) with your art. Replace &amp;lt;code&amp;gt;Player&amp;lt;/code&amp;gt;&amp;#039;s movement with your controls: keep input as &amp;lt;code&amp;gt;[ToServer]&amp;lt;/code&amp;gt; calls and state as &amp;lt;code&amp;gt;[Synced]&amp;lt;/code&amp;gt; fields.&lt;br /&gt;
# Replace &amp;lt;code&amp;gt;Arena&amp;lt;/code&amp;gt; with your rules, started from &amp;lt;code&amp;gt;session.Started&amp;lt;/code&amp;gt; on the server.&lt;br /&gt;
# Give your objects keys from your own data (level ids, entity ids).&lt;br /&gt;
# Add your votes (&amp;lt;code&amp;gt;VoteKind&amp;lt;/code&amp;gt; with a &amp;lt;code&amp;gt;Check&amp;lt;/code&amp;gt; and a &amp;lt;code&amp;gt;Passed&amp;lt;/code&amp;gt;) and your menu items.&lt;br /&gt;
# Teach &amp;lt;code&amp;gt;GameBot&amp;lt;/code&amp;gt; your game, so the smoke test proves a real round.&lt;br /&gt;
# Move engine-free rules into an assembly with &amp;lt;code&amp;gt;noEngineReferences&amp;lt;/code&amp;gt; and test it with plain &amp;lt;code&amp;gt;dotnet test&amp;lt;/code&amp;gt;, as [[Unity.Multiplayer/articles/case-study-cursory|Unity.Cursory does]].&lt;br /&gt;
&lt;br /&gt;
== Without the wizard ==&lt;br /&gt;
&lt;br /&gt;
Each piece also works on its own, in an existing project:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;strong&amp;gt;MindAttic ▸ Multiplayer ▸ Add Front End&amp;lt;/strong&amp;gt; networks the open scene (a NetworkManager with Unity Transport, a &amp;lt;code&amp;gt;NetBootstrap&amp;lt;/code&amp;gt; and a prefab list) and adds &amp;lt;code&amp;gt;NetFrontEnd&amp;lt;/code&amp;gt;. If MindAttic Components is missing, it names the manifest line. See [[Unity.Multiplayer/articles/front-end|Drop-in front end]].&lt;br /&gt;
* &amp;lt;strong&amp;gt;MindAttic ▸ Multiplayer ▸ Set Up Scene&amp;lt;/strong&amp;gt; does the same without the menus. Drive the session from your own UI (below).&lt;br /&gt;
* &amp;lt;strong&amp;gt;Add Component ▸ MindAttic ▸ Multiplayer ▸ Net Votes&amp;lt;/strong&amp;gt; adds votes. See [[Unity.Multiplayer/articles/votes|Votes]].&lt;br /&gt;
* &amp;lt;strong&amp;gt;MindAttic ▸ Multiplayer ▸ Validate Prefabs&amp;lt;/strong&amp;gt; checks every network prefab before you ship.&lt;br /&gt;
* [[Unity.Multiplayer/articles/porting|Porting a game]] moves an existing networked project onto the package.&lt;br /&gt;
&lt;br /&gt;
=== Drive it from your own UI ===&lt;br /&gt;
&lt;br /&gt;
The front end&amp;#039;s buttons and your own UI make the same calls on &amp;lt;code&amp;gt;NetBootstrap&amp;lt;/code&amp;gt;, the component on the NetworkManager:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Action&lt;br /&gt;
! Call&lt;br /&gt;
|-&lt;br /&gt;
| Host&lt;br /&gt;
| &amp;lt;code&amp;gt;bootstrap.StartHost()&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Join by IP&lt;br /&gt;
| &amp;lt;code&amp;gt;bootstrap.JoinByAddress(address, port)&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Host with a join code&lt;br /&gt;
| &amp;lt;code&amp;gt;await bootstrap.HostWithCode()&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Join by code&lt;br /&gt;
| &amp;lt;code&amp;gt;await bootstrap.JoinByCode(code)&amp;lt;/code&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| Leave&lt;br /&gt;
| &amp;lt;code&amp;gt;bootstrap.Leave()&amp;lt;/code&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;bootstrap.Session&amp;lt;/code&amp;gt; is the live &amp;lt;code&amp;gt;NetSession&amp;lt;/code&amp;gt;. &amp;lt;code&amp;gt;IsActive&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;IsHost&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;State&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;PublishedCodeText&amp;lt;/code&amp;gt; read its state. &amp;lt;code&amp;gt;Started&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;Ended(Disconnection)&amp;lt;/code&amp;gt; say when it starts and why it ended, and &amp;lt;code&amp;gt;JoinCodeFailed&amp;lt;/code&amp;gt; says why a code could not be made or used. &amp;lt;code&amp;gt;DisconnectText.For(disconnection)&amp;lt;/code&amp;gt; turns an ending into the same plain words the front end shows.&lt;br /&gt;
&lt;br /&gt;
=== Settings in code ===&lt;br /&gt;
&lt;br /&gt;
The Inspector holds &amp;lt;code&amp;gt;NetBootstrap&amp;lt;/code&amp;gt;&amp;#039;s default settings. Code (a menu, a launcher, a test) sets them with &amp;lt;code&amp;gt;Configure&amp;lt;/code&amp;gt; instead, before the session starts:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;md-code lang-csharp&amp;quot;&amp;gt;bootstrap.Configure(new NetConfig { Topology = Topology.Server, Port = 47961, GameVersion = &amp;quot;1.2&amp;quot; });&lt;br /&gt;
// or change a few and keep the rest:&lt;br /&gt;
bootstrap.Configure(c =&amp;gt; { c.Port = 47961; c.MaxPlayers = 4; });&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Configure&amp;lt;/code&amp;gt; copies the config and validates it; &amp;lt;code&amp;gt;ArgumentException&amp;lt;/code&amp;gt; lists every problem. It is refused with &amp;lt;code&amp;gt;InvalidOperationException&amp;lt;/code&amp;gt; while the session is running. &amp;lt;code&amp;gt;DefaultConfig&amp;lt;/code&amp;gt; reads the current defaults back. The environment and the command line (&amp;lt;code&amp;gt;-port&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;-transport&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;-mode&amp;lt;/code&amp;gt;, ...) still win over both the Inspector and &amp;lt;code&amp;gt;Configure&amp;lt;/code&amp;gt;, so a launch line can always retarget a build.&lt;br /&gt;
&lt;br /&gt;
== The samples ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;strong&amp;gt;Window ▸ Package Manager ▸ MindAttic Multiplayer ▸ Samples&amp;lt;/strong&amp;gt; has three:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;strong&amp;gt;Game Template&amp;lt;/strong&amp;gt;: what New Game copies. Prefer the menu, which also checks the manifest, renames the namespace, gives the assets fresh GUIDs and writes &amp;lt;code&amp;gt;mp-host.json&amp;lt;/code&amp;gt;.&lt;br /&gt;
* &amp;lt;strong&amp;gt;Front End&amp;lt;/strong&amp;gt;: a square per player with the drop-in menus, and the hooks in one script.&lt;br /&gt;
* &amp;lt;strong&amp;gt;Minimal&amp;lt;/strong&amp;gt;: the same arena with a small hand-made IMGUI menu that calls &amp;lt;code&amp;gt;NetBootstrap&amp;lt;/code&amp;gt; directly, and no extra packages. Its &amp;lt;code&amp;gt;README.md&amp;lt;/code&amp;gt; walks through every line, including a &amp;lt;code&amp;gt;[ToClients]&amp;lt;/code&amp;gt; call.&lt;br /&gt;
&lt;br /&gt;
== Where to next ==&lt;br /&gt;
&lt;br /&gt;
* [[Unity.Multiplayer/articles/kit|The kit]]: the three packages and which piece does which job.&lt;br /&gt;
* [[Unity.Multiplayer/articles/case-study-cursory|Case study: Unity.Cursory]]: a full game built this way.&lt;br /&gt;
* [[Unity.Multiplayer/articles/front-end|Drop-in front end]], [[Unity.Multiplayer/articles/players|Players]], [[Unity.Multiplayer/articles/votes|Votes]], [[Unity.Multiplayer/articles/objects|Networked objects by key]].&lt;br /&gt;
* [[Unity.Multiplayer/articles/testing|Testing]] and [[Unity.Multiplayer/articles/bots|Bots]].&lt;br /&gt;
* [[Unity.Multiplayer/articles/topologies|Topologies]], [[Unity.Multiplayer/articles/join-codes|Join codes]] and [[Unity.Multiplayer/articles/hosting|Hosting]] once your server outlives the editor.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;md2wiki-crumb&amp;quot;&amp;gt;Part of [[Unity.Multiplayer]].&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;md2wiki-source&amp;quot;&amp;gt;From [https://github.com/mindattic/Unity.Multiplayer/blob/main/docs/articles/getting-started.md Unity.Multiplayer/docs/articles/getting-started.md] via MindAttic.Docs; synced automatically, so edit the repo, not this page.&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Unity.Multiplayer]]&lt;/div&gt;</summary>
		<author><name>Docs Sync</name></author>
	</entry>
</feed>