Ok, so i'm trying to add a small ad to my game with google's admob. I donwloaded all i had to download, and the demo worked perfectly. However, when i try to adapt the code to my game, the c# script doesn't even run. I aded a debug log in the start function, but it's not showing up in the log. Alsno, i'm trying to access a JS variable from a C# script. I placed the JS in the standard assets so it compiles first and i would be able to get to the variable. Dont know it that makes any difference though..
Here's a bit of the code (Start and Update)
EDIT 1: The script IS atached to a game obect. In fact the same object the other JS is attached to.
using System;
using UnityEngine;
using GoogleMobileAds;
using GoogleMobileAds.Api;
// Example script showing how to invoke the Google Mobile Ads Unity plugin.
public class AdManager : MonoBehaviour
{
bool shown = false;
private GameManagerHard jsScript;
private BannerView bannerView;
private InterstitialAd interstitial;
void Start()
{
RequestBanner();
jsScript = this.GetComponent ();
Debug.Log ("start");
}
void Update()
{
if(jsScript.GO && !shown)
{
bannerView.Show();
shown = true;
Debug.Log (jsScript.GO);
}
}
↧