# Session
To authenticate your game and track player metrics at runtime, Frameplay requires an active Session. A session establishes a runtime connection to Frameplay servers.
# Starting a Session
Start a Session by calling Frameplay.Session.Start()
. This needs to be called once when the game is launched.
We have provided an example script FrameplaySDK/Example/Scripts/FrameplayStartSession.cs
that will initialize the SDK and register the in-game camera.
# Parameters
Camera: A Unity Camera (opens new window) that will be registered and used for tracking Ad Space viewability. If no camera parameter is provided,
Camera.main
will be used by default.Player Data: A struct containing the current players
Age
andGender
. If available, these can be sourced from a custom login or client API. This enables Frameplay to serve more relevant advertisements to the player.
# Stopping a Session (Optional)
Call Frameplay.Session.Stop()
to stop the Frameplay Session. This will trigger the SDK to clean up associated resources. Sessions will automatically end on game exit.
# Register Camera
If the active in-game camera changes during gameplay, call Frameplay.Session.SetCamera()
to change the registered camera.