# Session & Cameras

Here we cover the Frameplay Session & Registered Camera in Unity.

For more information on Frameplay Sessions, Cameras and best practices see our Developer Guidelines.

# Starting a Session

Start a Frameplay Session by calling Frameplay.StartSession(). This only needs to be called once, ideally at launch.

Follow the Install Guide to use our "StartSession.cs" example script.

The StartSession() parameters are as follows:

  • Frameplay Data Asset (Required): This is a reference to the Frameplay Data Asset. This can be referenced by a Game Object in the Scene (StartSession.cs example), loaded using Resources (opens new window) or Asset Bundles (opens new window).

  • Player Data (Optional): If available, the players Age and Sex should be passed as parameters to the StartSession call. These can be sourced from a client API or a custom login. This data allows for targeted advertisements.

  • Action Delegate (Optional): Action (opens new window) called when the Frameplay session has successfully started. Typically used for registering a camera once the SDK is initialized.

# Registered Cameras

The Frameplay Session requires a reference to a Unity Camera (opens new window). This should be called each time the active camera changes.

The camera is used for gathering metrics and activating advertisements colliders. Only one Camera Object can be registered at any one time. They can be registered and deregistered when required.

# Register

Register a Unity Camera object by calling Frameplay.RegisterCamera(). The easiest way to do this is to use the StartSession callback parameter.

Frameplay.RegisterCamera() parameters are as follows:

# Deregister

Deregister a camera by calling Frameplay.DeregisterCamera() from a Unity Script (opens new window). There are no parameters required.

More information on the Frameplay API.

Last Updated: 8/30/2023, 3:46:32 AM