Game: Yes2SDK.game

← Back to overview

Gameplay lifecycle signals, invite links, platform settings, and clipboard. The gameplay signals are the most important part: platforms use them to time ads and measure engagement.


Methods (Core)

SignatureDescription
gameplayStart(): voidActive gameplay started (not menus/loading).
gameplayStop(): voidActive gameplay stopped (death, pause, menu, before an ad).
happyTime(): voidSignal a positive moment (high score, level complete).
inviteLink(paramsJson: string): Promise<string>Generate an invite URL embedding params. paramsJson = JSON string of Record<string,string>. Returns the URL.
getInviteParam(key: string): stringRead a param from the launching invite link. Empty string if absent.
showInviteButton(paramsJson: string): voidShow a platform invite button.
hideInviteButton(): voidHide the platform invite button.
getSettings(): stringPlatform game settings as a JSON string.
copyToClipboard(text: string): voidCopy text to clipboard.
getServerTimeAsync(): Promise<number>Current server time as Unix epoch milliseconds. Falls back to the local Date.now() clock where there's no server-time API.

Platform support

MethodPokiGameDistributionCrazyGamesYandexYouTube
gameplayStartReadyPartial¹ReadyReadyPartial²
gameplayStopReadyPartial¹ReadyReadyPartial²
happyTimeNoneNoneReadyNoneNone
inviteLinkReady³NoneReadyNoneNone
getInviteParamReady⁴NoneReadyNoneNone
showInviteButtonNoneNoneReadyNoneNone
hideInviteButtonNoneNoneReadyNoneNone
getSettingsNone⁵None⁵Ready⁶None⁵Ready⁷
copyToClipboardPartial⁸Partial⁸Partial⁸Partial⁸Partial⁸
getServerTimeAsyncPartial⁹Partial⁹Partial⁹ReadyPartial⁹

¹ Internal state only: GameDistribution has no platform gameplay call. ² YouTube sets an internal flag; the real lifecycle uses firstFrameReady/gameReady (driven by the SDK's startGame). ³ PokiSDK.shareableURL. ⁴ PokiSDK.getURLParam. ⁵ Returns "{}". ⁶ Reads CrazyGames disableChat/muteAudio. ⁷ Reads system.getLanguage() + isAudioEnabled(). ⁸ Uses the browser navigator.clipboard (and CrazyGames' copyToClipboard where present), not a dedicated platform API. ⁹ No server-time API: returns the local (unsynced) device clock via Date.now(). Yandex returns tamper-proof ysdk.serverTime().


Unity (C#)

Yes2SDK.Game. Event static event Action<GameSettings> OnSettingsChanged.

SignatureDescription
void GameplayStart() / void GameplayStop()
void HappyTime()
void InviteLinkAsync(Dictionary<string,string> parameters, Action<string> onSuccess = null, Action<Error> onError = null) / Task<string> …(CancellationToken)
string GetInviteParam(string key)
void ShowInviteButton(Dictionary<string,string> parameters = null) / void HideInviteButton()
GameSettings GetSettings()
void CopyToClipboard(string text)Editor uses GUIUtility.systemCopyBuffer.

GameSettings (struct): DisableChat, MuteAudio.


Defold (Lua)

Defold routes the gameplay-lifecycle signals through the session_* namespace (session_gameplay_start / session_gameplay_stop; see session.md). The game_* namespace covers the rest.

SignatureDescription
yes2sdk.game_happy_time()Positive-moment signal (CrazyGames uses it for ad timing).
yes2sdk.game_get_settings()JSON string of settings ("{}" if unavailable).
yes2sdk.game_copy_to_clipboard(text)
yes2sdk.game_invite_link(params_json, callback)params_json = JSON object. callback(self, success, url_or_err).
Pitch your game