Skip to Content
Engine SDKsUnity (C#)

Install

Add to Packages/manifest.json:

{ "dependencies": { "dev.plot.client": "https://github.com/plot-ws/plot-unity.git" } }

Quickstart

using Plot; var plot = new PlotClient(new PlotOptions { AppKey = "pl_pub_live_xxx", PlayerId = System.Guid.NewGuid().ToString(), }); var room = await plot.JoinAsync(new JoinOptions { RoomCode = "lobby-1" }); room.OnMessage += e => Debug.Log($"{e.From}: {e.Data}"); room.Send(new { x = 100, y = 200 });

Interpolation & prediction

room.Interpolate("players.*.position", "vec2", renderDelay: 100); void Update() => room.TickFrame(); room.AttachPrediction(initialState, (state, input, player) => Reduce(state, input, player)); room.Predict("players.me.position", "vec2", correctionMs: 100); room.SendPredicted(new { move = "left" }); var past = room.SampleAt("players.p1.position", "vec2", now - room.ServerClockOffset - 120);

There’s also a Window/Plot editor window for protocol version, app-key config, and a connection test. The Runtime is UnityEngine-free, so it compiles standalone. See Snapshot interpolation and Client prediction for the concepts.

Last updated on