Requirements
● Officially released Unity versions 5.6 or later.
● Compute shader compatible devices
- ■ Windows PC with Directx 11 or 12 graphics API and Shader Model 5.0 GPU
- ■ macOS and iOS using Metal graphics API
- ■ Android, Linux and Windows platforms using Vulkan API
- ■ Modern Open GL platforms (Open GL 4.3 for windows and Open GL ES 3.1 for Android)
If you are building an Android application and want to test your application in the Unity editor, it is a requirement to use DirectX11 and to do that you need to check “No Emulation” in Edit -> Graphics Emulation -> No Emulation. This is required to be set each time you start Unity.
Running the editor on Mac will work if you in build settings are supporting either Standalone or iOS and are running the Metal Editor Support (see Player settings->Other Settings).
Setup SDK
Import the SDK
● Download and extract the Unity SDK from the link you were given in your registration mail.
● Drag and drop the “adverty” folder in your Unity project.
Setup the SDK
- ■ Click the dropdown Adverty > Settings and add the two application keys provided to you in your registration mail, one for “RELEASE” and one for “SANDBOX”. If no key is supplied no ads will be loaded to the project.
- ■ Use Sandbox mode when testing your application and for test builds. Your Release build will require the Environment switch to be set to “RELEASE” in order for live adverts to be sent to your application and for you to start earning revenue. The selected Environment mode will be used when building your application. In In Unity editor, Sandbox will always be used.
Unit.prefab
In AR or Mobile SDK it is possible to choose between Clickable and NonClickable in unit inspector. For VR NonClickable is the default setting.
NonClickable: this option will provide image campaigns only.
Image AD
- ■ One Unit will receive an AD. The Units are of ratios Box (1.2:1), Landscape (16:9 for AR/VR and 3.88:1 for Mobile) or Portrait (1:2) and fitting ads will be provided during application runtime. Revenue will be generated based on a CPM model.
Clickable (only available for AR and mobile):
This option will provide one campaign including 3 types of content. One image ad, one video ad and one play store/App store landing page. It starts with an Image AD just as NonClickable type, but when the unit is clicked it now iterates through the different contents. Revenue will be generated based on a combination of CPM, CPCV and CPI models.
● Image AD
- ■ Same format and revenue model as the image AD for NonClickable.
● Video AD
- ■ This video will play between 15-30 seconds in fullscreen only if the user decides to click on the unit (which is showing the image AD). Revenue will be generated based on a CPCV model.
● Download Link
- ■ When the video is finished, a landing page for either Google play store or App store will be loaded on the screen. If the user downloads the advertised application the revenue will be based on a CPI model.
Setup AdUnits
● Add an ad unit to your scene
- ■ Locate the Unit.prefab in Assets/adverty/Prefabs/ in the project window hierarchy.
- ■ Drag the prefab into the scene and position it as you do with any regular game objects in Unity.
- ■ Snap the ad unit to a surface.
○ The ad unit can be attached to any surface by activating the “Snap to surface” checkbox in the top left corner of the preview window. When the ad unit is selected, click on a desired surface to attach the ad unit to it. This will adjust the position and rotation of the ad unit to match the attached surface.
● Ad unit settings
- ■ The ad unit is bendable in one axis at the time (X-axis or Y-axis) and in either direction (concave or convex). Click the “Bend” checkbox in the SmartBend™ section to activate this feature.
- ■ VR only: In the SceneContext™ section, set the properties of the ad unit according to the context of the surrounding scene. Try to be as specific as possible to optimize the ad relevance. This will maximize the eCPM and your revenue. Note that some context settings have the option to select more than one predefined value.
● Test your ad units with real-time impression indicator
- ■ The ImpViz™ real-time impression indicator shows when ad units placed in the scene generates impressions or not, to help optimize the monetization potential of each ad unit.
- ■ Click the dropdown Adverty > Settings and click the checkbox ImpViz™ to enable impression debugging in the game.
- ■ When playing the application in Unity the ad units will tint green when the first ad impression is registered and tint red each time it registers an impression after that. This gives a good understanding of how the ad unit should be designed and placed in the scene to generate impressions.
Interact with Clickable Unit (AR and mobile only)
Requires a scene with an EventSystem to be able to trigger clicks.
The clickable unit is a great possibility for you to utilize rewarded ads. Rewarded video ads provide a reward to users if they watch the entire video ad. The reward is up to you to define. It can be a virtual currency, in-game goods for the application or something else. To use this functionality there are three public events to your exposal on the Unit.
Unit.onVideoDone
When a user has watched the entire video ad this event will trigger. The event returns the GameObject of the completed Unit. Here follows a code snippet showing how to use it.
void Start()
{
Adverty.Unit.onVideoDone += Reward;
}
private void Reward(GameObject unit)
{
//GIVE THE REWARD TO THE USER
}
Unit.onOpen
As the video and store landing page will be shown in fullscreen over your application there is an event that triggers when this overlay is opened. This can be used if your application requires for example pausing. Here follows a code snippet showing how to use it.
void Start()
{
Adverty.Unit.onOpen += Pause;
}
private void Pause(GameObject unit)
{
//PAUSE THE GAME
}
Unit.onClose
Whenever the fullscreen overlay is closed the Unit.onClose event triggers. If you have paused the game this is probably when you want to resume it. Here follows a code snippet showing how to use it.
void Start()
{
Adverty.Unit.onClose += Resume;
}
private void Resume(GameObject unit)
{
//RESUME THE GAME
}
NOTE: If your rewards includes visuals and some in-game event, this should be executed on Unit.onClose. However, the reward should still be given on Unit.onVideoDone. (Unit.onClose can be triggered without Unit.onVideoDone being triggered. For example if the user decides to cancel the video before it finished and close the ad overlay)
NOTE 2: This unit uses a native overlay for Android/iOS to display the video ad and landing page. That means it is not possible to test the full flow inside Unity Editor. This requires running on an Android/iOS device.
General advices
Adverty-sdk requires internet to load ads programmatically during runtime and there is always a possibility an ad is not delivered. To give the user an as enjoyable experience as possible we suggest the following actions.
Apply your own texture
You can apply your own texture to a unit. This makes it so that if the AdUnit is not receiving an ad your desired texture will be shown. If an ad is delivered your texture will be replaced by the ad. The ratio of the adUnits are 1.2:1, 1:2 or 16:9 for VR and AR and 1.2:1, 1:2 or 3.88:1 for Mobile. Here is how to do this.
void Start()
{
unit.GetComponent<Renderer>().material.mainTexture = yourTexture;
}
Disable MeshRenderer
You can disable the MeshRenderer on the Unit-prefab. When an ad is delivered the MeshRenderer is activated. This enables the AdUnit not to render in the game until an actual ad is delivered. You can do this either via the inspector or via code.
void Start()
{
unit.GetComponent<MeshRenderer>().enabled = false;
}