So I have used google admob plugin for unity for my game. On the google admob apps page i set it to refresh every 50 second. But when I am playing the game, the ads won't refresh unless I restart the game. Also I see the same 3 or 4 ads every time.
using UnityEngine;
using System.Collections;
using GoogleMobileAds.Api;
public class AdControl : MonoBehaviour {
public string ad_unit_id = "mt app unit id";
// The ad banner display object.
BannerView bannerView;
// Update is called once per frame
void Start () {
// Create a smart banner at the bottom of the screen.
bannerView = new BannerView(
ad_unit_id, AdSize.SmartBanner, AdPosition.Bottom);
// Create an empty ad request.
AdRequest request = new AdRequest.Builder()
.Build();
// Load the banner with the request.
bannerView.LoadAd(request);
}
void Update() {
if (Game.stateElapsedFrames == 1) {
// Let's not show the ad during gameplay, so the player doesn't
// get distracted. Showing ad on title screen may be bad for
// the public view of the company.
if (Game.state == Game.State.GameOver) {
bannerView.Show();
} else {
bannerView.Hide();
}
}
}
}