Skip to main content

Lifecycle and diagnostics

Page lifecycle​

For every page:

  1. receive the screen contract or presenter through injection;
  2. call Observe (or SubscribeAsync) once when the page opens;
  3. render each call. A screen contract's render always runs on the Unity main thread; a presenter listener may not, so switch to the main thread before touching Unity objects;
  4. when the page closes, dispose that exact IDisposable and cancel the page's token.

Use async void only for Unity entry points (OnEnable, button handlers), and catch OperationCanceledException there.

Scenes​

The SDK root survives scene loads, and leaving a scene does not sign the player out. The Login scene derives from ProjectVLoginSceneScope; every other scene derives from ProjectVAuthenticatedSceneScope, which sends the player to Login when nobody is signed in. Never put an SDK root in another scene, and never keep screens or presenters in static fields.

Realtime​

The SDK connects, reconnects and routes realtime messages itself. Game code never opens a socket; new data simply arrives through Observe and SubscribeAsync.

Logout​

Call IProjectVAccountPresenter.LogoutAsync (or delete the account). When the snapshot reports RequiresLoginNavigation, load the Login scene. The SDK has already cleared the session and the previous account's data; do not delete PlayerPrefs or tokens yourself.

Reading the Console​

The Editor Console shows one entry per SDK action:

[ProjectV · Lobby] Refresh OK · 474 ms · app resume · from server
RPC player/sync 450 ms req cd761e71
Cache hit profile, stamina
trace 5903a6a1 (open in SDK Debugger)
  • First line: the screen, the action and its result (OK; BLOCKED as a Warning; FAILED or UNKNOWN as an Error), how long it took, what started it (scene enter, player action, app resume, startup, or after <Screen> · <Action>), and what changed, for example stamina 120->119.
  • Lines below: each server call with its req ID, what came from the cache, and for a failure the error code with a short explanation, for example Error SHOP_LIMIT_REACHED (conflict, not retryable): The purchase limit for this offer is reached.
  • trace: click it to open Tools › SilverTiger › CrossSDK › SDK Debugger on that action.

When you report a problem, include the req and trace values of the failed action (see What to send the SDK team).