Please note that our SDK only supports Unity on Android at the moment. Support for iOS and other platforms (Oculus Rift, HTC Vive) will follow very soon.

Your time is valuable; For that reason we tried to make the setup of the VIRE SDK as efficient as possible.

The VIRE SDK for Unity

Follow these simple steps to learn how to integrate the VIRE SDK into your Unity project:

(1) Please download the current VIRE SDK for Unity:

vire.unitypackage 0.2.9

(2) Import it into your current Unity project:

Import Picture

(3) If you don't have a VIRE account yet, please create a new one here:

https://server.vire.co/#/register

(4) Login and create a new entry for your app here:

https://server.vire.co/#/create/app

After you have saved your new app entry, it will receive an unique App UUID (see the red oval in screenshot below). You will need this App UUID for the next step.

Create new app entry

To create a new app please provide the name of your app and its Google Play Store ID. The video below shows, where to find the Google Play Store ID of your game in Unity:

(5) Finally integrate the Vire SDK into your Unity project. The code below shows a full example:

using UnityEngine;
using Vire;

public class AdManager : MonoBehaviour
{
    private void Start()
    {
        // Insert your App UUID below, which you received in step (4):
        VIRE.init("** insert your App UUID here **");
    }

    public void showAd()
    {
        AdOptions options = new AdOptions { callback = myCallback };
        StartCoroutine( VIRE.requestAd(options));
    }

    private void myCallback(AdResult result)
    {
        switch (result)
        {
            case AdResult.Finished:
                Debug.Log("The ad was successfully shown.");
                break;
            case AdResult.Skipped:
                Debug.Log("The ad was skipped before reaching the end.");
                break;
            case AdResult.NoAd:
                Debug.LogError("No ad available.");
                break;
            case AdResult.Failed:
                Debug.LogError("The ad failed to be shown.");
                break;
        }
    }
}

To create such a script for your game do the following:

  1. Create a new MonoBehaviour script and add it to a GameObject in your scene. Add the Vire namespace and initialize the VIRE script in the Start() function by calling VIRE.init(strind appUuid) with your App UUID. After you have initialized Vire, the ads are available in all levels of your game.

  2. Create an AdOptions object and hand over the callback function to react to the possible results of the ad request. Call VIRE.requestAd(options) in a coroutine to request an ad asynchronously from our ad server.

  3. The callback function adcallback will be called when the ad has finished, has been skipped, the request could not be filled or the ad request failed. Accordingly, the parameter AdResult is either Finished, Skipped, NoAd or Failed.

Please have a look at the VIRE Unity API for more settings and options Unity API.

If you need any assistance, please send us an email (team@vire.co).