# Session & Cameras

Here we cover some more engine specific details about sessions and their usage. It's worth checking out the Unity API Documentation as we use certain function calls.

For information on non engine specific details, see here.

# Starting a Session

Starting a session is as simple as calling Frameplay.StartSession() from within any Unity Script. We include a StartSession.cs under "Assets\FramePlaySDK\Example" (used in step 3 of our Install Guide) to make starting a session easy.

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 or Asset Bundles.

  • Player Data (Optional): The player Age, Sex, Gamer ID or Tag and Language can be sourced from a client API or a custom login. This data allows for targeted advertisements.

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

Warning: The example Start Session script does not pass any player data, meaning ads won't be targeted. This class is purely demonstrative and should be replaced prior releasing your project.

# Registered Cameras

The Frameplay Session requires knowledge of a Unity Camera, used for gathering metrics and triggering advertisements colliders. Camera Objects can be registered and unregistered--when required--but only one camera can be registered at a time.

# Register

To do this you must have first started a session (see above) then by calling Frameplay.RegisterCamera() from within any Unity Script. The easiest way to do this is to use the StartSession callback parameter.

Frameplay.RegisterCamera() parameters are as follows:

# Unregister

To do this you simply call Frameplay.UnregisterCamera() from within any Unity Script. If there isn't any registered camera you will simply get a warning stating you need to register a camera before attempting to unregister a camera.

Last Updated: 6/11/2020, 2:14:39 AM