# Frameplay API

# Unity Scripts

# Start a Frameplay Session

/// <summary>
/// Initialize Frameplay SDK Session
/// </summary>
/// <param name="dataAsset">Scriptable object Frameplay asset</param>
/// <param name="playerAge">If player data is present</param>
/// <param name="playerGender">If player data is present</param>
/// <param name="playerId">If player data is present</param>
/// <param name="playerLanguage">If player data is present</param>
/// <param name="sessionStarted">Optional Action called when the Session has started successfully</param>
public static void StartSession(FrameplayDataAsset dataAsset, int playerAge = -1, Gender playerGender = Gender.Unknown, string playerId = "", SystemLanguage playerLanguage = SystemLanguage.Unknown, Action sessionStarted = null)

/// <summary>
/// Initialize Frameplay SDK Session
/// </summary>
/// <param name="dataAsset">Scriptable object Frameplay asset</param>
/// <param name="playerAge">If player data is present</param>
/// <param name="playerGender">If player data is present</param>
/// <param name="playerId">If player data is present</param>
/// <param name="playerLanguage">If player data is present (Should be in ISO_639-1 https://en.wikipedia.org/wiki/ISO_639-1 )</param>
/// <param name="sessionStarted">Optional Action called when the Session has started successfully</param>
public static void StartSession(FrameplayDataAsset dataAsset, int playerAge = -1, Gender playerGender = Gender.Unknown, string playerId = "", string playerLanguage = "", Action sessionStarted = null)

# Register a Camera







 

/// <summary>
/// Register a Camera object for position tracking and Ad Space activation detection
/// Note. Only one camera can be tracked at any given time
/// Creates a component & trigger collider on the given object
/// </summary>
/// <param name="camera">Camera Object</param>
void RegisterCamera(UnityEngine.Camera camera)

You can register a camera inside the Action passed into StartSession().

# Unregister a Camera




 

/// <summary>
/// Unregister the currently registered Camera object. Pauses all metrics and future advertisements from /// being loaded.
/// </summary>
void UnregisterCamera()

# Get the Registered Camera





 

/// <summary>
/// Get currently registered camera
/// </summary>
/// <returns>The currently registered camera. Null if none are registered.</returns>
UnityEngine.Camera GetRegisteredCamera()

# Has the Session Started?




 

/// <summary>
/// Has SDK session successfully started
/// </summary>
bool SessionStarted

# Is a Camera Registered?





 

/// <summary>
/// Is a camera currently registered
/// </summary>
/// <returns>True if a camera is currently registered.</returns>
bool IsCameraRegistered()

# FrameplayAdSpace





 








































































/// <summary>
/// Unique identifier generated when the Ad Space is registered.
/// Field is shown on the Developer Dashboard
/// </summary>
public string AdSpaceId;

/// <summary>
/// Used to identify the Ad Space.
/// Field is shown on the Developer Dashboard
/// </summary>
public string Description;

/// <summary>
/// Advertisements of this ratio will be displayed on this Ad Space.
/// When scaling the Ad Space in Editor, this ratio will be enforced.
/// Field is shown on the Developer Dashboard
/// </summary>
public ImageRatio Ratio;

/// <summary>
/// A Paused Ad Space will remain in it's 'Placeholder' state, and will not
/// request Ads.
/// </summary>
public bool Paused

/// <summary>
/// Single instance types are used if there will only ever be one instance of
/// this Ad Space.
/// Multi is used if the Ad Space will have multiple instances
/// eg. part of a procedurally generated level.
/// Field is shown on the Developer Dashboard
/// </summary>
public InstanceType GameObjectInstanceType;

/// <summary>
/// A Dynamic Ad Space will refresh with a new advertisement every 60 seconds.
/// A Static Ad Space will hold the first advertisement they load for the
/// duration of the Frameplay Session or until destroyed.
/// Field is shown on the Developer Dashboard.
/// </summary>
public RefreshType RefreshType;

/// <summary>
/// Optional activation collider
/// </summary>
public Collider ActivationCollider;

/// <summary>
/// If no advertisement is currently displayed and
/// if unchecked the Ad Space will be invisible.
/// If checked however, the Ad Space will be visible and
/// will display the PlaceHolderMaterial
/// </summary>
public bool PlaceholderVisibleDuringPlay;

/// <summary>
/// The material used when there is no advertisement currently displayed.
/// Can be changed to a material more fitting of your environment
/// </summary>
public Material PlaceHolderMaterial;

/// <summary>
/// The material used when displaying an advertisement.
/// Texture is overridden to display advertisements
/// </summary>
public Material AdMaterial;

/// <summary>
/// Scale multiplier for downloaded ad texture size.
/// </summary>
public TextureQualityMultiplier AdTextureScaleMultiplier;

/// <summary>
/// Event fired when new Ad content has loaded.
/// </summary>
public UnityEvent OnAdLoaded;
Last Updated: 6/9/2020, 5:49:53 AM