I'm using Unity 4.5, and have a hard time integrating admob into my game.
The thing is, I can't access it. I can't declare it, call .Show(), .Hide() or anything else. I got this error-message: NullReferenceException: Object reference not set to an instance of an object.
It doesn't make any sense to me. It seems like the variable isn't global in the class. But I can't see why. It isn't a problem with any other variable in class.
It is a big problem, since I can't have the banner at all.
What can I do to fix it?
My code:
using UnityEngine;
using System.Collections;
using GoogleMobileAds;
using GoogleMobileAds.Api;
public class GameManager : MonoBehaviour {
public BannerView PauseView;
void Start(){
// Create a 320x50 banner at the top of the screen.
BannerView PauseView = new BannerView(
"Hidden for you guys", AdSize.Banner, AdPosition.Top);
// Create an empty ad request.
AdRequest request = new AdRequest.Builder().Build();
// Load the banner with the request.
PauseView.LoadAd(request);
}
}