0% found this document useful (0 votes)
37 views1 page

Ad Script

This 3 sentence summary provides the key details about the code: The code shows how to display a banner ad in a Unity game by initializing a BannerView with an ad unit ID and size, building an AdRequest to load test ads, and calling LoadAd to display the banner ad at the top of the screen on startup. It includes options for loading test ads during development or real ads for production, and defines the ad unit ID, size, and position for the banner ad to ensure it loads and displays properly.

Uploaded by

Denyss Firondoiu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views1 page

Ad Script

This 3 sentence summary provides the key details about the code: The code shows how to display a banner ad in a Unity game by initializing a BannerView with an ad unit ID and size, building an AdRequest to load test ads, and calling LoadAd to display the banner ad at the top of the screen on startup. It includes options for loading test ads during development or real ads for production, and defines the ad unit ID, size, and position for the banner ad to ensure it loads and displays properly.

Uploaded by

Denyss Firondoiu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

​using GoogleMobileAds.

Api;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AdScript : MonoBehaviour {

// Use this for initialization


void Start () {

showBannerAd();

private void showBannerAd()


{
string adID = “​ca-app-pub-8291560708755403/1572650379”;

//***For Testing in the Device***


AdRequest request = new AdRequest.Builder()
.AddTestDevice(AdRequest.TestDeviceSimulator) // Simulator.
.AddTestDevice("2077ef9a63d2b398840261c8221a0c9b") // My test device.
.Build();

//***For Production When Submit App***


//AdRequest request = new AdRequest.Builder().Build();

BannerView bannerAd = new BannerView(adID, AdSize.SmartBanner, AdPosition.Top);


bannerAd.LoadAd(request);
}

// Update is called once per frame


void Update () {

}
}

You might also like