Unity 3D TR Forum

Orjinalini görmek için tıklayınız: AdMob Reklam hata yardim
Şu anda (Arşiv) modunu görüntülemektesiniz. Orjinal Sürümü Görüntüle internal link
Merhaba arkadaslar Linkleri görüntüleyebilmek için Kayıt ol manız veya Giriş yapmanız gerekiyor.Anlayışınız için teşekkürler.! izleyerek AdMob reklami yapmaya calistim ama hata verdi bi buttona ekliyorum buttonun uzerine dokundugum zaman oyundan cikiyor oyun durdu yaziyor 

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

public class AdManiger : MonoBehaviour {

    private BannerView bannerView;
    [SerializeField] private string appID = "000000000000000000000000";
    [SerializeField] private string bannerID = "00000000000000000000000000000000";
    [SerializeField] private string regularAD = "0000000000000000000000000000000000";

    private void Awake()
    {
        MobileAds.Initialize(appID);
    }

    public void OnClickShowBanner()
    {
        this.RequsetBanner();
    }

    public void OnClickSlowAd()
    {
        this.RequsetRegularAD();
    }
    private void RequsetRegularAD()

    {
        InterstitialAd AD = new InterstitialAd(regularAD);
        AdRequest request = new AdRequest.Builder().Build();
        AD.LoadAd(request);



    }


    private void RequsetBanner()
    {

        bannerView = new BannerView(bannerID, AdSize.Banner, AdPosition.Bottom);

        AdRequest requset = new AdRequest.Builder().Build();

        bannerView.LoadAd(requset);
    }

}


kod bu..bu kodu AdManiger scripti olusturup ekledikten sonra bi tane reklam karakter ekliyorum o karaktere scripti ekledikten sonra 2 edet buttona tanimliyorum ve kaydediyorum unity programinda zaten bisey gosdermiyor oyun calisiyor telefona yukledigim zaman o buttona dokundugum zaman oyundan cikiyor button bos hicbisey olmasin ve ya basla Start butdonu olsun farketmez hangisine eklediysem ona bastigin zaman oyundan cikiyor
Size benim kullandığım kodu gönderiyorum. Sorunsuz çalışıyor:


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

public class Ad_Manager : MonoBehaviour
{
    InterstitialAd interstitial;

    private void Start()
    {
        StartAdmob();
        RequestBanner();
        if(SceneManager.GetActiveScene().name!="GameUI")
        Invoke("RequestInterstitial", 5f);
    }

    private void StartAdmob()
    {
#if UNITY_ANDROID
        string appId = "Uygulama Reklam Kimliği Yazmalısınız";
#elif UNITY_IPHONE
        string appId = "-";
#else
        string appId = "unexpected_platform";
#endif
        // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(appId);
    }


    private void RequestBanner()
    {
#if UNITY_EDITOR
        string adUnitId = "unused";
#elif UNITY_ANDROID
        string adUnitId = "Banner reklam id sini yazmalısınız";
#elif UNITY_IPHONE
        string adUnitId = "INSERT_IOS_BANNER_AD_UNIT_ID_HERE";
#else
        string adUnitId = "-";
#endif

        // Create a 320x50 banner at the top of the screen.
        BannerView bannerView = new BannerView(adUnitId, AdSize.SmartBanner, AdPosition.Bottom);
        // Create an empty ad request.
        AdRequest request = new AdRequest.Builder().Build();
        // Load the banner with the request.
        bannerView.LoadAd(request);
    }

    private void RequestInterstitial()
    {
#if UNITY_ANDROID
        string adUnitId = "Geçiş reklam id nizi yazmalısınz";
#elif UNITY_IPHONE
        string adUnitId = "INSERT_IOS_INTERSTITIAL_AD_UNIT_ID_HERE";
#else
        string adUnitId = "-";
#endif

        // Initialize an InterstitialAd.
        interstitial = new InterstitialAd(adUnitId);
        // Create an empty ad request.
        AdRequest request = new AdRequest.Builder().Build();
        // Load the interstitial with the request.
        interstitial.LoadAd(request);
    }

    public void LoadInterstitial()
    {
        if (interstitial.IsLoaded())
        {
            interstitial.Show();
            RequestInterstitial();
        }
    }
}

Start fonksiyonundaki
  if(SceneManager.GetActiveScene().name!="GameUI")
satırını çıkartırsınız


Birde geçiş reklamı için   LoadInterstitial()   metodunu butona bağlamalısınız
(06-01-2019, Saat: 22:41)mtat0640 Nickli Kullanıcıdan Alıntı: Linkleri görüntüleyebilmek için Kayıt ol manız veya Giriş yapmanız gerekiyor.Anlayışınız için teşekkürler.!Size benim kullandığım kodu gönderiyorum. Sorunsuz çalışıyor:


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

public class Ad_Manager : MonoBehaviour
{
    InterstitialAd interstitial;

    private void Start()
    {
        StartAdmob();
        RequestBanner();
        if(SceneManager.GetActiveScene().name!="GameUI")
        Invoke("RequestInterstitial", 5f);
    }

    private void StartAdmob()
    {
#if UNITY_ANDROID
        string appId = "Uygulama Reklam Kimliği Yazmalısınız";
#elif UNITY_IPHONE
        string appId = "-";
#else
        string appId = "unexpected_platform";
#endif
        // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(appId);
    }


    private void RequestBanner()
    {
#if UNITY_EDITOR
        string adUnitId = "unused";
#elif UNITY_ANDROID
        string adUnitId = "Banner reklam id sini yazmalısınız";
#elif UNITY_IPHONE
        string adUnitId = "INSERT_IOS_BANNER_AD_UNIT_ID_HERE";
#else
        string adUnitId = "-";
#endif

        // Create a 320x50 banner at the top of the screen.
        BannerView bannerView = new BannerView(adUnitId, AdSize.SmartBanner, AdPosition.Bottom);
        // Create an empty ad request.
        AdRequest request = new AdRequest.Builder().Build();
        // Load the banner with the request.
        bannerView.LoadAd(request);
    }

    private void RequestInterstitial()
    {
#if UNITY_ANDROID
        string adUnitId = "Geçiş reklam id nizi yazmalısınz";
#elif UNITY_IPHONE
        string adUnitId = "INSERT_IOS_INTERSTITIAL_AD_UNIT_ID_HERE";
#else
        string adUnitId = "-";
#endif

        // Initialize an InterstitialAd.
        interstitial = new InterstitialAd(adUnitId);
        // Create an empty ad request.
        AdRequest request = new AdRequest.Builder().Build();
        // Load the interstitial with the request.
        interstitial.LoadAd(request);
    }

    public void LoadInterstitial()
    {
        if (interstitial.IsLoaded())
        {
            interstitial.Show();
            RequestInterstitial();
        }
    }
}

Start fonksiyonundaki
  if(SceneManager.GetActiveScene().name!="GameUI")
satırını çıkartırsınız


Birde geçiş reklamı için   LoadInterstitial()   metodunu butona bağlamalısınız

Tesekkur ederim ne yaptimsa olmadi yapamadim aynen dedigin gibi yaptim Ad_Maniger scripti icerisine bu kodu ekledim ve Main Camera icerisine ekledim  if(SceneManager.GetActiveScene().name!="GameUI") bu kodu silerek ve ya onune // atarak kapatdim ama oyuna girdigim zaman menyu aciliyor ve basla buttonuna tikladigim zaman level 1 aciliyor ve duruyor hicbisey yapamiyorsun ne oyundan cikamiyorum nede bi buttona basabiliyorum hicbisey oyunda haraket etmiyoru destek buttonu yaratdim ve buttonda eklenti olarak main camera ekleyip Ad_Maniger den LoadInterstitial secerek ekledim ama yinede ayni sey oldu simdi oyundan cikmiyor ama oyun duruyor hicbisey yapamiyorsun reklam gelmiyor oyundan cikip yeniden girmek gerekiyor nerde yalnis yapiyorum?hatam nasil bisey yardim ede bilirmisiniz rica etsem?Ad_Maniger scripti main Cameradan kaldirdigim zaman oyun calisiyor
start metodundaki herşeyi silip denermisin? Yine hata verecek mi
(09-01-2019, Saat: 00:15)mtat0640 Nickli Kullanıcıdan Alıntı: Linkleri görüntüleyebilmek için Kayıt ol manız veya Giriş yapmanız gerekiyor.Anlayışınız için teşekkürler.!start metodundaki herşeyi silip denermisin? Yine hata verecek mi

public void LoadInterstitial()
    {
        if (interstitial.IsLoaded())
        {
            interstitial.Show();
            RequestInterstitial();
        }
    } 

bu kodu boyle yaptim


 public void LoadInterstitial()

    {      

            RequestInterstitial();

        

    }
}

hata kalkti ama destek buttonuna tikladigim zaman oyun duruyor ve oyundan cikiyor
SORUNU DÜZELTEBİLDİNMİ NASIL DÜZELTİN BENDEDE AYNI SORUN VAR SIANDA
(06-01-2019, Saat: 22:41)mtat0640 Nickli Kullanıcıdan Alıntı: Linkleri görüntüleyebilmek için Kayıt ol manız veya Giriş yapmanız gerekiyor.Anlayışınız için teşekkürler.!Size benim kullandığım kodu gönderiyorum. Sorunsuz çalışıyor:


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

public class Ad_Manager : MonoBehaviour
{
    InterstitialAd interstitial;

    private void Start()
    {
        StartAdmob();
        RequestBanner();
        if(SceneManager.GetActiveScene().name!="GameUI")
        Invoke("RequestInterstitial", 5f);
    }

    private void StartAdmob()
    {
#if UNITY_ANDROID
        string appId = "Uygulama Reklam Kimliği Yazmalısınız";
#elif UNITY_IPHONE
        string appId = "-";
#else
        string appId = "unexpected_platform";
#endif
        // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(appId);
    }


    private void RequestBanner()
    {
#if UNITY_EDITOR
        string adUnitId = "unused";
#elif UNITY_ANDROID
        string adUnitId = "Banner reklam id sini yazmalısınız";
#elif UNITY_IPHONE
        string adUnitId = "INSERT_IOS_BANNER_AD_UNIT_ID_HERE";
#else
        string adUnitId = "-";
#endif

        // Create a 320x50 banner at the top of the screen.
        BannerView bannerView = new BannerView(adUnitId, AdSize.SmartBanner, AdPosition.Bottom);
        // Create an empty ad request.
        AdRequest request = new AdRequest.Builder().Build();
        // Load the banner with the request.
        bannerView.LoadAd(request);
    }

    private void RequestInterstitial()
    {
#if UNITY_ANDROID
        string adUnitId = "Geçiş reklam id nizi yazmalısınz";
#elif UNITY_IPHONE
        string adUnitId = "INSERT_IOS_INTERSTITIAL_AD_UNIT_ID_HERE";
#else
        string adUnitId = "-";
#endif

        // Initialize an InterstitialAd.
        interstitial = new InterstitialAd(adUnitId);
        // Create an empty ad request.
        AdRequest request = new AdRequest.Builder().Build();
        // Load the interstitial with the request.
        interstitial.LoadAd(request);
    }

    public void LoadInterstitial()
    {
        if (interstitial.IsLoaded())
        {
            interstitial.Show();
            RequestInterstitial();
        }
    }
}

Start fonksiyonundaki
  if(SceneManager.GetActiveScene().name!="GameUI")
satırını çıkartırsınız


Birde geçiş reklamı için   LoadInterstitial()   metodunu butona bağlamalısınız
Dostum toplam 10 gündür sabah 9 da kalkıp gece 3e doğru bu sorunu çözmeye çalıştım başıma gözüme ağrılar girdi stresten. Nerdeyse 0 umutla forumda dolaşırken gördüğüm yorumunu uyguladım ve her şey halloldu gerçekten sana çok teşekkür ederim allah razı olsun.