Unity SDK Installation Guide

This guide will take you through the steps of setting up the Unity SDK.

This guide assumes:

Editor Setup

1. Download and Import SDK

Importing Packages

Download and import the FrameplaySDK.unitypackage into your chosen Unity project.

We support Unity 2018 or higher. Package has been submitted using Unity 2018.4.2f1

2. Setup Data Assets

Scriptable Objects

The Frameplay Data Asset is a Scriptable Object and used to maintain the link between your Unity project and the Developer Dashboard.

1. To create, use the GameObject menu option and select Frameplay > Create > DataAssets.

2. Locate and select the newly created FrameplayData.asset from in the Project window under Assets/FrameplaySDK/Data/.

3. From inside the Inspector window, set the Developer API Key and Game ID with the appropriate values. These are found on the Games Page on the Frameplay Platform.

3. Create an Ad Space

Game Objects

What is an Ad Space? An Ad Space is a Unity GameObject that displays targeted advertisements to the player.

1. Click the GameObject menu option and select Frameplay > Create > Ad Space. Doing so will create a new Ad Space GameObject in the current Scene, in front of the Camera.

The Ad Space Debug Text is displayed red to signal that it is unregistered.

4. Register an Ad Space

Ad Spaces must be registered to link with the Frameplay servers. This allows advertisements to be requested and loaded at runtime. When playing in Editor, a Development Build or in Test Mode, placeholder advertisements will be used. When playing in a non-development build, real advertisements will load, enabling metrics gathering and monetization.

1. Select the newly created Unregistered Ad Space from the Hierarchy or Scene view.

2. Modify the Ad Space information if required, in the Inspector Window under the FrameplayAdSpace component.

It's good practice to write a description, this will help identify Ad Spaces later on. More information about Ad Space Properties.

3. Click Register Ad Space.

5. Start the Frameplay Session

Scripts, Cameras

What is a Frameplay Session? A Session is a run-time connection to the Frameplay servers.

Once a Session is started, Ad Spaces can request and load advertisements in game.

Note that the session should be started when a player begins your game. For example during your loading sequence. The session is automatically shutdown when a player quits the application.

1. Begin by calling Frameplay.StartSession().

2. Once the session has started, register a camera by calling Frameplay.RegisterCamera().

Click for Code Example
using FrameplaySDK;
using UnityEngine;
using UnityEngine.Analytics;

public class StartSession : MonoBehaviour
{
    public FrameplayDataAsset DataAsset;
    public Camera Camera;

    // Start is called before the first frame update
    void Start()
    {
        Frameplay.StartSession(DataAsset, 28, Gender.Male, "Gamer", SystemLanguage.English, RegisterCamera);
    }

    private void RegisterCamera()
    {
        Frameplay.RegisterCamera(Camera);
    }
}

Parameters

  • Frameplay Data Asset Scriptable Object Reference (Required)
  • Player information (Optional)
  • Action triggered When session has successfully started (Optional)

The Frameplay Session requires knowledge of a Camera to use for gathering metrics and triggering advertisements.
Only one camera can be registered at a time.
Cameras can be registered and unregistered when required.

More information on the Frameplay API.

Publishing a Release Build

Publishing Builds

For full functionality, your developer account and game must have passed through the Frameplay approval process. The current wait time for game approval is 48 hours. You can continue with these steps before the approval process has been completed however only mock advertisements will load during run-time and no advertisements will load in non-development builds.

When you are ready to build a Release/Production version of your project, uncheck the Test Mode checkbox in the Frameplay Data Asset. This will allow Ad Spaces to request and load real revenue raising advertisements. More information

Last Updated: 11/4/2019, 12:28:34 AM