Runtime/: plain .NET Standard 2.1 with no Unity references and no reflection. It runs under IL2CPP and in any .NET app.Unity/: token storage in PlayerPrefs and a converter that usesJsonUtility.
Types
Platforms
Install
In Unity, open Window > Package Manager. Click +, then Install package from git URL, and enter:v0.22.12 on works.
Sign in and call a function
Authorization: Bearer. Every method throws PylonException. For an HTTP error, the exception has the status, the server’s error code, and the message.
The client also has these methods:
SignInWithAppleAsync,SignInWithGoogleAsync, andSignInWithSteamAsync(see Native sign-in)StartMagicCodeAsyncandVerifyMagicCodeAsyncSignInWithPasswordAsyncandRegisterWithPasswordAsyncRefreshSessionAsyncandStartSessionAutoRefreshListAsync,ListCursorAsync,GetAsync,CreateAsync,UpdateAsync, andDeleteAsyncAggregateAsyncandSearchAsyncRequestAsync, for any other route
Live queries
- The server sends each insert, update, and delete the caller may read. Read policies and field redaction apply on the server.
RowsandChangedchange on the client’s dispatcher.- After a reconnect, the query pulls from its cursor, so it loses no change.
- Rows come from entities with
syncon (the default).
Your own types
Function arguments, results, and snapshots arePylonValue. A missing key reads as PylonValue.Null, so snapshot["players"][0]["x"] does not throw.
To use your own types, give an IPylonConverter<T>. The SDK calls the converter and does not use reflection. For a [Serializable] class, use JsonUtilityConverter<T>.Instance.
Join a shard
Sendreturns the input’s sequence number. A frame’sAckis the highest sequence number the shard processed.- For a MessagePack shard, inputs go as MessagePack. For all other shards, inputs go as JSON.
- A replicating shard fills
shard.Entities. TheReplicationevent gives the spawned, updated, and despawned ids. - When the server moves the player to another shard,
Transferredruns. The connection then goes to the new shard. - The server can refuse a ticket, or the ticket can expire. The connection then stops, unless
TicketProvidergives a new ticket. IdleTimeoutreconnects when no frame arrives. Use it only for tick-driven shards.
A render loop
ShardGame<TInput> puts the connection, the clock, interpolation, and prediction together.
- A predictor from
Predictrecords each sent input, drops refused inputs, and resets when the connection reopens. Sendreturns 0 when it did not send. Do not predict that input.Sendstamps each input with the tick the lastFramedrew, for a shard with lag compensation.
WebTransport
Over WebTransport (QUIC), entity updates travel as datagrams. A lost packet delays only its own update. Over a WebSocket, it holds back every frame behind it.WebSocketis the default forShardConnection.WebTransportuses WebTransport only.Autois the default forShardGame. It uses WebTransport when the session opens, and a WebSocket otherwise.- Auto uses a WebSocket when the plugin is missing, the app does not serve WebTransport, UDP is blocked, the session does not open in 3 s, or datagrams stop.
- The server serves WebTransport when
PYLON_WEBTRANSPORT_PORTis set. shard.Transportgives the transport of the open connection.
Plugins/:
- macOS (arm64 and x86_64)
- Windows x86_64
- Linux x86_64
- iOS (device and simulator)
- Android arm64-v8a and armeabi-v7a
Threads
The SDK runs callbacks on theSynchronizationContext of the thread that made the client or connection. In Unity, make them on the main thread. Events then run on the main thread, and you can change GameObjects in them. Dispose the connection and the client in OnDestroy.
Sample
The package has an Arena sample. It signs in as a guest, callsjoinArena, joins the arena shard, and moves your player. To run it:
- Run
pylon devinexamples/shard-arena. To use WebTransport, setPYLON_WEBTRANSPORT_PORT=4324. - Import the sample from Package Manager > Pylon > Samples.
- Open the scene and press Play.
Tests
The tests run with the .NET SDK. Unity includes one atUnity.app/Contents/Resources/Scripting/DotNetSdk.
packages/realtime/src/replication.fixtures.json and packages/realtime/src/wire.fixtures.json. The Rust encoders write these files, so a change to the wire format fails all three clients until each one matches.