<?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%2Freconnect-seats</id>
	<title>Unity.Multiplayer/articles/reconnect-seats - 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%2Freconnect-seats"/>
	<link rel="alternate" type="text/html" href="https://mindattic.com/wiki/docs/index.php?title=Unity.Multiplayer/articles/reconnect-seats&amp;action=history"/>
	<updated>2026-12-05T16:11:09Z</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/reconnect-seats&amp;diff=935&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/reconnect-seats&amp;diff=935&amp;oldid=prev"/>
		<updated>2026-11-29T20:37:11Z</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;= Reconnect and seats =&lt;br /&gt;
&lt;br /&gt;
A player who drops gets the same spot back: the same seat index, the same player object, not a new one spawned from scratch. This is built on an engine-free &amp;lt;code&amp;gt;SeatRegistry&amp;lt;/code&amp;gt; (testable with plain &amp;lt;code&amp;gt;dotnet test&amp;lt;/code&amp;gt;, no Unity required) plus the adapter wiring that keeps a live session in step with it.&lt;br /&gt;
&lt;br /&gt;
== Connection approval ==&lt;br /&gt;
&lt;br /&gt;
Before a client is seated at all, it&amp;#039;s approved. Both the host&amp;#039;s own player and every joining client send an identity (a stable player token, display name, colour), the game&amp;#039;s version and a protocol hash (one hash per assembly, computed over every RPC and &amp;lt;code&amp;gt;[Synced]&amp;lt;/code&amp;gt; signature — see [[Unity.Multiplayer/articles/attributes#How a call is handled, and what the generator writes|Attributes reference]]). &amp;lt;code&amp;gt;NetSession&amp;lt;/code&amp;gt;&amp;#039;s approval callback checks, in order:&lt;br /&gt;
&lt;br /&gt;
# &amp;lt;strong&amp;gt;Payload readable&amp;lt;/strong&amp;gt; — malformed bytes are rejected outright.&lt;br /&gt;
# &amp;lt;strong&amp;gt;Game version&amp;lt;/strong&amp;gt; — &amp;lt;code&amp;gt;NetConfig.GameVersion&amp;lt;/code&amp;gt; must match.&lt;br /&gt;
# &amp;lt;strong&amp;gt;Protocol hash&amp;lt;/strong&amp;gt; — the generated RPC/synced shapes must match: a client built against different networked code is refused before it can call anything unexpected.&lt;br /&gt;
# &amp;lt;strong&amp;gt;Ban list&amp;lt;/strong&amp;gt; — &amp;lt;code&amp;gt;IBanList&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;InMemoryBanList&amp;lt;/code&amp;gt;, or your own implementation set on &amp;lt;code&amp;gt;NetSession.BanList&amp;lt;/code&amp;gt;.&lt;br /&gt;
# &amp;lt;strong&amp;gt;Capacity&amp;lt;/strong&amp;gt; — &amp;lt;code&amp;gt;NetConfig.MaxPlayers&amp;lt;/code&amp;gt;, with a returning player&amp;#039;s own held seat excluded from the count.&lt;br /&gt;
# &amp;lt;strong&amp;gt;Seating&amp;lt;/strong&amp;gt; — once past the checks above, &amp;lt;code&amp;gt;SeatRegistry.Claim&amp;lt;/code&amp;gt; seats the connection; a token whose seat is the host&amp;#039;s own and still connected is refused here instead (&amp;lt;code&amp;gt;TokenInUse&amp;lt;/code&amp;gt;, see below).&lt;br /&gt;
&lt;br /&gt;
A rejection carries a typed &amp;lt;code&amp;gt;ApprovalRejection&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;BadPayload&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;VersionMismatch&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ProtocolMismatch&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Banned&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;Full&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;TokenInUse&amp;lt;/code&amp;gt;) and a wire reason string; the client&amp;#039;s &amp;lt;code&amp;gt;NetSession.LastDisconnect&amp;lt;/code&amp;gt; reports it in plain language, and &amp;lt;code&amp;gt;NetSession.ConnectionRejected&amp;lt;/code&amp;gt; fires server-side.&lt;br /&gt;
&lt;br /&gt;
== Seats ==&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;code&amp;gt;Seat&amp;lt;/code&amp;gt; is a player&amp;#039;s slot on the server: &amp;lt;code&amp;gt;Index&amp;lt;/code&amp;gt; (stable for the seat&amp;#039;s life), the &amp;lt;code&amp;gt;PlayerToken&amp;lt;/code&amp;gt; that owns it, &amp;lt;code&amp;gt;DisplayName&amp;lt;/code&amp;gt;/&amp;lt;code&amp;gt;Color&amp;lt;/code&amp;gt; as last seen, and a &amp;lt;code&amp;gt;Status&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 enum SeatStatus&lt;br /&gt;
{&lt;br /&gt;
    Occupied, // a connected client sits in it&lt;br /&gt;
    Held,     // its player dropped; waiting for the same token until Seat.HeldUntil&lt;br /&gt;
    Released, // freed — a snapshot only, the registry no longer has it&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When a connection drops, its seat isn&amp;#039;t freed immediately: it goes &amp;lt;code&amp;gt;Held&amp;lt;/code&amp;gt; until &amp;lt;code&amp;gt;NetConfig.ReconnectGraceSeconds&amp;lt;/code&amp;gt; (default 60) passes, and a held seat still counts against capacity (so nobody else takes a dropped player&amp;#039;s spot the instant they lag out). The same player token reconnecting within that window reclaims the seat — same &amp;lt;code&amp;gt;Index&amp;lt;/code&amp;gt;, and the adapter respawns the &amp;lt;strong&amp;gt;same player object&amp;lt;/strong&amp;gt; for the new connection instead of spawning another one (&amp;lt;code&amp;gt;SeatReclaimed&amp;lt;/code&amp;gt;). A token still seated on a connection the server hasn&amp;#039;t yet noticed is dead (a killed client restarted, for example) &amp;lt;strong&amp;gt;takes the seat over&amp;lt;/strong&amp;gt; from the stale connection, which the server then drops (&amp;lt;code&amp;gt;SeatClaimOutcome.TookOver&amp;lt;/code&amp;gt;); this is the one case where the server proactively closes a connection it hasn&amp;#039;t heard disconnect yet.&lt;br /&gt;
&lt;br /&gt;
The host&amp;#039;s own seat is the one exception: it is never taken over while connected. A player token is remembered per install folder (see below), so a second copy of the same build launched from that folder and joined by IP sends the &amp;lt;em&amp;gt;host&amp;#039;s own token&amp;lt;/em&amp;gt; — not a stale reconnect, since the host never legitimately comes back through the join path. That join is refused (&amp;lt;code&amp;gt;SeatClaimOutcome.Refused&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ApprovalRejection.TokenInUse&amp;lt;/code&amp;gt;) rather than bumping the host out of its own lobby and game (UM-T77).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre class=&amp;quot;md-code lang-csharp&amp;quot;&amp;gt;session.SeatTaken    += seat =&amp;gt; { /* a new player took the lowest free seat */ };&lt;br /&gt;
session.SeatReclaimed += seat =&amp;gt; { /* came back within the grace window */ };&lt;br /&gt;
session.SeatHeld     += seat =&amp;gt; { /* dropped; held until seat.HeldUntil */ };&lt;br /&gt;
session.SeatReleased += seat =&amp;gt; { /* grace ran out, or the player was kicked */ };&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;session.Seats&amp;lt;/code&amp;gt; lists every current seat; &amp;lt;code&amp;gt;session.TryGetSeat(clientId, out seat)&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;session.GetSeatPlayerObject(seatIndex)&amp;lt;/code&amp;gt; look one up. Seats live on the server only; every peer, clients included, sees the players through &amp;lt;code&amp;gt;session.Roster&amp;lt;/code&amp;gt; ([[Unity.Multiplayer/articles/players|Players, names and colours]]), where a held seat is a player with &amp;lt;code&amp;gt;IsConnected&amp;lt;/code&amp;gt; false who keeps their record, seat and name when they come back. &amp;lt;code&amp;gt;session.Kick(clientId, reason)&amp;lt;/code&amp;gt; releases a seat immediately and sends the reason before closing the connection.&lt;br /&gt;
&lt;br /&gt;
=== Remembering a player across restarts ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;NetBootstrap&amp;lt;/code&amp;gt;&amp;#039;s &amp;lt;strong&amp;gt;Remember Player&amp;lt;/strong&amp;gt; option (on by default) keeps the player&amp;#039;s token in &amp;lt;code&amp;gt;PlayerPrefs&amp;lt;/code&amp;gt;, keyed per install folder, so quitting and relaunching the game still reclaims the same seat; &amp;lt;code&amp;gt;-playertoken &amp;amp;lt;token&amp;gt;&amp;lt;/code&amp;gt; on the command line overrides it (useful for the nightly smoke test&amp;#039;s bot clients, which need a stable identity without &amp;lt;code&amp;gt;PlayerPrefs&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
== Disconnect reasons ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;Disconnection&amp;lt;/code&amp;gt; on the client side, and &amp;lt;code&amp;gt;PlayerDisconnected&amp;lt;/code&amp;gt; server-side, carry a typed &amp;lt;code&amp;gt;DisconnectReason&amp;lt;/code&amp;gt;: &amp;lt;code&amp;gt;ClientLeft&amp;lt;/code&amp;gt; (a clean leave), &amp;lt;code&amp;gt;Kicked&amp;lt;/code&amp;gt; (with the server&amp;#039;s reason text), &amp;lt;code&amp;gt;TimedOut&amp;lt;/code&amp;gt;, a rejected &amp;lt;code&amp;gt;Connection&amp;lt;/code&amp;gt; (one of the approval reasons above), or a transport failure. A kick or a stale-connection takeover sends the reason as its own small reliable message before closing the connection, rather than relying on the transport&amp;#039;s own disconnect signal — which can arrive with no payload at all on a lossy link — so the reason is never lost even under [[Unity.Multiplayer/articles/topologies#Testing a bad connection|simulated packet loss]].&lt;br /&gt;
&lt;br /&gt;
== Where this is tested ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;dotnet test tests/Core.Tests&amp;lt;/code&amp;gt; covers &amp;lt;code&amp;gt;SeatRegistry&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;ConnectionAdmission&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;ConnectionApprovalValidator&amp;lt;/code&amp;gt; with no Unity at all. The PlayMode suite&amp;#039;s &amp;lt;code&amp;gt;ApprovalAndSeatTests&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;LossyNetworkTests&amp;lt;/code&amp;gt; exercise the whole path end to end — drop and reconnect to the same seat, a killed client&amp;#039;s restart taking its seat over, grace expiry, and a kick&amp;#039;s reason surviving a lossy link. See [[Unity.Multiplayer/articles/testing|Testing]] for how to run them.&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/reconnect-seats.md Unity.Multiplayer/docs/articles/reconnect-seats.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>