Unity VR Ads by OmniVirt. Integrate and earn revenues in minutes. Sign up today.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Unity VR Ads - OmniVirt Ad Network for Unity (iOS, Android, Cardboard, Gear VR, Daydream)


Meet the OmniVirt's Unity VR Ad SDK. OmniVirt Ad Network is VR Advertising Network which enables developers and publishers to monetize their apps/games with seamless and engaging VR experiences.

Simply integrate the OmniVirt Unity Ad SDK into your Unity application/game and get paid for presenting sponsored 360° video experiences to your users. Backfill your inventory with premium CPM experiences from OmniVirt’s network of advertisers. We support both 360° and 2D video ads inside VR apps.

OmniVirt Unity Ad SDK could be used on Unity 5.3 or newer.


OmniVirt Unity Ad SDK can be integrated into your Unity game in just few easy steps.

Get Started

  1. Sign up for an account at OmniVirt
  2. Create one or more Ad Spaces for your app (for each Ad Space you can select different content and will get separate reporting)
  3. Keep the AdSpace ID assigned for further use.

Now an Ad Space is ready. Next step is to enable the Ad on your application/game.

Add the OmniVirt SDK to your project

  1. Download OmniVirtSDK.unitypackage

  2. Import it to your Unity project via Assets -> Import Package -> Custom Package menu.


Your project will now contain all necessary files to integrate OmniVirt Unity VR ads in your game.

Switch Platform

Currently OmniVirt Ad Network for Unity is supported only on iOS and Android. So to make it works, you need to switch platform to either iOS or Android first. To do so, click at File -> Build Settings, choose your target platform (iOS or Android) and then click Switch Platform.

Switch Platform

Please note that if you do not switch the platform, your code will not be able to compile.

Prepare a script

First, create an empty GameObject in the scene.


And then, create a C# script and rename it to AdNetworkControl.


Drag the script and drop it on a created GameObject to assign it to the scene.


Initialize a VRAd instance

Open AdNetworkControl.cs file and add the following line in the header area.

using OmniVirt;

Declare VRAd variable and initialize in Start() function.

public class AdNetworkControl : MonoBehaviour {

    VRAd vrAd;

    // Use this for initialization
    void Start () {
        vrAd = new VRAd (AD_SPACE_ID); // Replace your Ad Space ID here
        // Register a Callback
        vrAd.AdStatusChanged += OnAdStatusChanged;

    // Update is called once per frame
    void Update () {


    void OnAdStatusChanged() {


Please note that your must replace AD_SPACE_ID with one you got from step above.

Load an Ad

Ad must be loaded first before it could be shown. Call LoadAd() like shown below to start loading.

    // Use this for initialization
    void Start () {
        vrAd = new VRAd (AD_SPACE_ID); // Replace your Ad Space ID here
        // Register a Callback
        vrAd.AdStatusChanged += OnAdStatusChanged;

        // Prepare an Ad

Ad will now be loaded in the background and once it is ready, OnAdStatusChanged will be called with Ready state.

Show an Ad

If you want ad to start playing automatically, just add the following code snippet to the callback function.

void OnAdStatusChanged() {
    if (vrAd.IsReady ()) {
        vrAd.Show (false);

Show an Ad in VR Mode

You can trig the ad to be displayed in VR Mode by passing a parameter in show() function like shown below.

vrAd.Show (true);

With this feature, you will be able to make Ad show with seamless experience as your VR app / game.

And it's all ... done ! Ad will now be shown on the screen.

Reload an Ad

LoadAd() is needed to be called once per ad served. You can reload an ad to make it ready for the next session by implementing the code inside OnAdStatusChanged like shown below.


IEnumerator ReloadAd() {
    yield return null;

    if (vrAd != null) {
        vrAd.Unload ();
        vrAd = null;

    vrAd.AdStatusChanged += OnAdStatusChanged;
    vrAd.LoadAd ();
void OnAdStatusChanged() {
    if (vrAd.IsCompleted ()) {
        // Reload an ad for next session
        StartCoroutine (ReloadAd ());


When the state of VRAd has been changed, OnAdStatusChanged callback function will be called with the new state in the AdStatusChangedEventArgs parameter.

void OnAdStatusChanged() {
    // New AdState could be retrieved from vrAd.adState

There are different 5 states in total.

  • AdState.Loading - Ad is being loaded in the background.

  • AdState.Ready - Ad is ready to be shown. You can call Show() function at this state to display the loaded ad.

  • AdState.Showing - Ad is being displayed.

  • AdState.Completed - Ad display is finished.

  • AdState.Failed - Ad could not be loaded.

Handle Back Pressed

On Android, back button is needed to be handled to prevent unexpected behavior.

    void Update () {
        // Handle Back Button
        if (Input.GetKeyDown (KeyCode.Escape)) {
            // If Ad is being shown, it will be automatically hide.
            // Don't do anything.
            if (vrAd.IsShowing ())

            // Else, do whatever you want, for example, quit the app
            //Application.Quit ();

Day Dream Controller Support

Since Day Dream game controller support is required on Day Dream compatible application / game, OmniVirt SDK also provides support on this funcionality as well. You can enable it with some easy following steps.

  1. Import Google VR SDK for Unity into your project. If your application or game is built for Day Dream, it supposes to have this SDK installed in your project already.

  2. Add GvrControllerMain and GvrEditorEmulator prefab to the scene.


  1. Add OmniVirtGameController script to GvrControllerMain game object. (It is important to add script to the correct one otherwise it would not work).

Add Component

That's all. Day Dream controller will now magically work with our VR Player in Day Dream mode !

iOS Build

Bitcode is not supported on OmniVirt SDK yet. Please turn the Bitcode off by set Build Settings -> Bitcode to off for your deployment target.



If you have any question, please don't hesitate to email us at adnetwork@omnivirt.com !