Lifecycle and diagnostics
Page lifecycle​
For every page:
- receive the screen contract or presenter through injection;
- call
Observe(orSubscribeAsync) once when the page opens; - render each call. A screen contract's
renderalways runs on the Unity main thread; a presenter listener may not, so switch to the main thread before touching Unity objects; - when the page closes, dispose that exact
IDisposableand 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;BLOCKEDas a Warning;FAILEDorUNKNOWNas an Error), how long it took, what started it (scene enter,player action,app resume,startup, orafter <Screen> · <Action>), and what changed, for examplestamina 120->119. - Lines below: each server call with its
reqID, what came from the cache, and for a failure the error code with a short explanation, for exampleError 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).