Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Windowed Ads for Dummies

Discussion in 'Unity Ads & User Acquisition' started by pDuaik, Jan 27, 2015.

  1. pDuaik

    pDuaik

    Joined:
    Jan 27, 2015
    Posts:
    1
    I'm new to Unity Ads and I'm trying all day long to understand how to display the ad in a window. The code I'm using is:

    Code (CSharp):
    1. void OnGUI()
    2.     {
    3.         if (GUI.Button(new Rect(10, 10, 150, 50), Advertisement.isReady() ? "Show Ad" : "Waiting..."))
    4.         {
    5.             // Show with default zone, pause engine and print result to debug log
    6.             Advertisement.Show(null, new ShowOptions
    7.             {
    8.                 pause = true,
    9.                 resultCallback = result =>
    10.                 {
    11.                     Debug.Log(result.ToString());
    12.                 }
    13.             });
    14.         }
    15.     }
    This code is available at the starter guide.

    I've also tried the demo project and I'm really lost how to achieve the windowed ad. The image below shows what I'm looking for. I know it's there but I just can't understand what to do.


    Can anyone help me changing the code i'm using to a new version with this overlay ad?

    Thank you very much.
     
  2. unity-nikkolai

    unity-nikkolai

    Joined:
    Sep 18, 2014
    Posts:
    540
    The ad you're seeing in the demo is an example of a picture ad. Video ads fill the screen edge to edge while picture ads have a windowed margin. Take a look at this forum post for more details and example code for picture ads.