Player Centric API - Lifecycle Functions

Provide power and flexibility to the game maker

APIs & Definitions

BeamContext.OnReady()Confirms BeamContext is running and the player has finished logging in.
BeamContext.Start()Starts tracking changes to the user state. Does nothing if the context has already been started.
BeamContext.Stop()Coroutines stop, subscriptions stop, deletes GameObject linked to context. Since it is a promise, it should be awaited, but it will still function in a synchronous context if there is no need to detect when it finishes. OnDispose will be called for all services when Stop is called.
BeamContext.ClearPlayerAndStop()Logs the player out and does the same thing as Stop(). Erases the PlayerId and access token. Calling Start() after this will grab a brand new player and fill it into the Context variable you were already using.
BeamContext.ChangeAuthorizedPlayer(TokenResponse)Switches the PlayerId of the context to the given player.

Note: BeamContext API calls will fail if it is stopped in the middle of an async method and will throw an exception. It must be started for these calls to work.

In the Unity Editor

When a BeamContext instance is initialized, a GameObject will be instantiated under Unity's "DontDestroyOnLoad" folder in the scene hierarchy. This GameObject will be named "Beamable" and contains information and behaviours for the currently running context, including:

• The current Authorized User
• Player Stats
• Subscription/Coroutine managers

Since this object is linked to the associated Context, calling Stop() on the context will delete this object, and vice versa.