# Frameplay API

# Unity Scripts

# Create a Player

/// <summary>
/// Creates a new player with default values.
/// </summary>
public Player()

/// <summary>
/// Creates a new player with no data collection
/// </summary>
/// <param name="allowDataCollection">Intended for false values</param>
public Player(bool allowDataCollection)

/// </summary>
/// Creates a new player with user input values and allows data collection
/// <param name="age">Player age</param>
/// <param name="gender">Player gender</param>
/// <param name="language">Unity system language</param>
/// <param name="id">Player tag (ex. "[ReB]", "Gamer")</param>
public Player(int age, Gender gender, SystemLanguage language, string id = "")

# Start a Frameplay Session

/// <summary>
/// Initialise Frameplay SDK Session
/// The Data Asset will be loaded using Resources.Load
/// </summary>
/// <param name="player">Frameplay Player class optionally containing age, Gender, Language etc.</param>
/// <param name="camera">Camera object to be registered for tracking</param>
public static void StartSession(Player player, Camera camera)


/// <summary>
/// Initialise Frameplay SDK Session
/// Reference the Frameplay Data Asset here to load as part of the Scene or Prefab.
/// If this property is left empty, the Data Asset will be loaded using Resources.Load
/// </summary>
/// <param name="dataAsset">Scriptable object loaded with the Scene or Prefab</param>
/// <param name="player">Frameplay Player class optionally containing age, Gender, Language etc.</param>
/// <param name="camera">Camera object to be registered for tracking</param>
public static void StartSession(FrameplayDataAsset dataAsset, Player player, Camera camera)

# 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 and trigger collider on the given object
/// </summary>
/// <param name="camera">Camera Object</param>
void RegisterCamera(UnityEngine.Camera camera)

# Deregister a Camera




 

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

# 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>
/// Ad spaces linked to the same channel will be synchronized together to show the same ads at the same time.
/// </summary>
public FrameplayAdChannel AdSpaceChannel;

/// <summary>
/// A paused Ad Space will not visually change, or download new content.
/// Intended for use in cutscenes when consistent visuals are more important than new impressions.
/// When multiple Ad Spaces are present in a channel, only set all or none of the Ad Spaces in the channel to Paused to avoid unexpected behavior
/// </summary>
public bool Paused;

/// <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>
/// Ad space mesh renderer
/// </summary>
public MeshRenderer MeshRenderer;

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

/// <summary>
/// True once an Ad has loaded
/// </summary>
public bool Loaded;

/// <summary>
/// Event fired when new Ad content has loaded.
/// </summary>
public AdSpaceEvent OnAdLoaded;

# AdSpaceData

/// <summary>
/// An ID that this object and its synchronized AdSpaces share on the Frameplay platform
/// </summary>
public string Id;

/// <summary>
/// An instance ID that is unique for each AdSpace gameobject
/// </summary>
public string InstanceId;

/// <summary>
/// Description of adSpace eg. location in scene or context
/// </summary>
public string Description;

/// <summary>
/// Image ratio
/// </summary>
public ImageRatio Ratio;

/// <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>
/// Ad Space registered with the server
/// </summary>
public bool Registered;
Last Updated: 8/25/2023, 9:49:58 AM