This guide will show you how to integrate the Frameplay plugin into your Unity project.
Download the Frameplay Unity plugin
Download the latest version of the Frameplay Unity plugin from the downloads page
Import the Frameplay Unity plugin
Open your project in the Unity editor. Select Assets > Import Package > Custom Package and find the FrameplayPlugin.unitypackage file you downloaded.
Make sure all of the files are selected and click Import.
Setup the Frameplay Data Asset
The Frameplay Data Asset is a Scriptable Object and used to maintain the link between your Unity project and the Frameplay Developer Dashboard.
- Create a new data asset Assets > Create > Framaplay > Data Asset
- Locate the Frameplay Data Asset in the Project window under the path Assets/FrameplaySDK/Data/FrameplayData.uasset
- Select the Frameplay Data Asset and in the Inspector window set the Developer API Key and Game ID with the corresponding values found on your Game Page.
- Save the changes to the asset File > Save Project.
Initialize Frameplay SDK
Before loading Ads, have your project initialize the Frameplay SDK by calling
Frameplay.StartSession() and register a Unity Camera object by calling
Frameplay.RegisterCamera(). This only needs to be done once, ideally at launch.
The Frameplay Session requires knowledge of a Camera to use for gathering metrics and triggering advertisements colliders. If you change camera, you need to register the new Camera Object. More information on Registered Cameras
We've included a "Start Session" example script to make set up quick an easy.
- Select any Game Object in the Hierarchy window, we chose the Main Camera.
- Click Add Component in the Inspector window, search for and add the "Start Session" script.
- Once added, create a reference to the Main Camera and Frameplay Data Asset to the respective Data Asset and Camera public properties. Do this by either dragging the objects into their respective slots or by searching for them.
The Frameplay SDK is now included in your Unity project and will be initialised at run-time. You're now ready to implement an Ad Space.
More information on the Frameplay API.
More information on the Frameplay Session & Cameras.