Server-side scenario execution: new Rudder.Core.dll, realtime/planstore glue removed

- Rudder.Core.dll rebuilt from csharp-sdk effects rewrite (96,768 bytes)
- Realtime/ adapters, UnityRealtimeTransportFactory, UnityPlanStateStore,
  UnityPlanScheduler, WebGL jslib and RealtimeUrl config deleted (with .meta)
- Scenarios sample rewired to client.Effects; samples login path updated
- AGENTS.md/README/CHANGELOG/package docs + agent skill updated; realtime.md skill doc removed
This commit is contained in:
edmand46
2026-09-04 14:23:38 +03:00
parent 22805173eb
commit 6d115f158e
71 changed files with 3338 additions and 1034 deletions
+37 -14
View File
@@ -1,10 +1,12 @@
# Rudder SDK for Unity
LiveOps SDK for Unity: device auth, player profile, remote config, stores,
inventory, leaderboards, battle pass, quests, storage, scenarios and realtime.
inventory, leaderboards, battle pass, quests, storage and scenarios.
The package wraps `Rudder.Core.dll` (the .NET SDK) with Unity adapters:
`UnityWebRequest` transport, `PlayerPrefs` token storage, websocket realtime.
`UnityWebRequest` transport and `PlayerPrefs` token storage.
Coding agents: read `AGENTS.md` before integrating this package into a game.
## Installation
@@ -21,7 +23,7 @@ your project's `Packages/manifest.json`:
}
],
"dependencies": {
"rudder.sdk": "0.3.0",
"rudder.sdk": "0.4.0",
"com.unity.nuget.newtonsoft-json": "3.2.2"
}
}
@@ -33,26 +35,25 @@ Newtonsoft.Json and the package does not bundle the DLL.
## Quickstart
Create a configuration asset via `Assets > Create > Rudder > Configuration`,
set `ProjectKey`, `BaseUrl` and `RealtimeUrl`, then initialize once at
startup:
set `ProjectKey`, add the `Rudder` component to a startup scene, assign the
asset, then:
```csharp
using RudderSdk.Unity;
Rudder.Initialize(configuration); // or add the Rudder component to a scene
var client = await Rudder.Ready; // faults if initialization failed
var client = Rudder.Initialize();
await client.Auth.LoginWithDeviceAsync("global", "en", nickname: "Player");
var session = await client.Auth.LoginWithDeviceAsync("global", "en", nickname: "Player");
var configs = await client.RemoteConfig.LoadAsync();
var stores = await client.Stores.ListAsync();
```
All features hang off the client: `Auth`, `Player`, `BattlePass`, `Quests`,
`Stores`, `Inventory`, `Leaderboards`, `RemoteConfig`, `Scenario`, `Storage`,
`Realtime`.
`Stores`, `Inventory`, `Leaderboards`, `RemoteConfig`, `Scenario`, `Effects`,
`Storage`.
```csharp
client.Scenario.OnStoreOffer += session => { /* show offer UI */ };
client.Effects.OnStoreOffer += effect => { /* show offer UI */ };
await client.Scenario.TriggerAsync("player_login");
var purchase = await client.Stores.PurchaseAsync("cozy-camp-shop", "moonberry-boost");
@@ -64,14 +65,36 @@ var top = await leaderboard.ListAsync(10);
## Lifecycle
- `Rudder.Initialize()` — synchronous. Reads the configuration on the scene
component and returns `RudderClient`. Idempotent. Throws if the component
or configuration is missing.
- `client.Auth.LoginWithDeviceAsync` — device login. Use this as the first
awaited call. Pending scenario effects are fetched after sign-in via the
per-frame `Update` heartbeat.
- `Rudder.State``NotInitialized` / `Initializing` / `Ready` / `Failed`.
- `Rudder.LastError` — the initialization error when `State` is `Failed`.
- `Rudder.Client` — the initialized `RudderClient`; throws until `Ready`.
- `Rudder.Ready` — task that completes with the client or the initialization
error; `Rudder.Initialized` is the event-flavored sugar over it.
- `Rudder.Client` — the initialized `RudderClient`; throws until `Initialize`.
- HTTP timeout defaults to 10 seconds, configurable per
`RudderConfiguration.TimeoutSeconds`.
Errors surface as `RudderApiException` subclasses from `RudderSdk.Core`:
`RudderAuthException` (401, session over), `RudderNotFoundException` (404),
`RudderRateLimitException` (429) and `RudderNetworkException` (no response).
## Samples
Import **Feature Samples** from the Package Manager (select the Rudder SDK
package, then Samples). Each scene is one API:
| Scene | SDK calls |
| --- | --- |
| Authentication | `Initialize`, `Auth.LoginWithDeviceAsync`, `Player.GetProfileAsync`, `Auth.Logout` |
| Remote Config | `RemoteConfig.LoadAsync`, `Get(key, fallback)` |
| Storage | `Storage.GetAsync`, `SaveAsync`, `DeleteAsync` |
| Store & Inventory | `Stores.ListAsync`, `PurchaseAsync`, `Inventory.GetAsync` |
| Leaderboards | `Leaderboards.FindBySlug`, `SubmitAsync`, `ListAsync` |
| Scenarios | `Scenario.TriggerAsync`, `Effects.OnNotification`, `Effects.OnStoreOffer`, … |
Assign a `RudderConfiguration` on the Sample object if the field is empty,
then press Play. In this repo the scenes are already visible at
`Assets/Samples/Rudder SDK/`.