Áú¹® ±×´ë·ÎÀÔ´Ï´Ù. À¯´ÏƼ¿¡¼´Â ±¤°í°¡ Àß ³ª¿À´Âµ¥ Á¤ÀÛ apk·Î ºôµåÇϰí Å×½ºÆ®ÇÏ´Ï ±¤°í°¡ ¾È ³ª¿É´Ï´Ù.
½ÇÁ¦ ±¤°í id³Ö¾îµµ ¾ÈµÇ°í Å×½ºÆ®±¤°í id³Ö¾îµµ ±¤°í°¡ ¾È³ª¿À°í ±â´Ù·ÁºÁµµ ±¤°í°¡ ¾È³ª¿Í¿ä
¹è³Ê±¤°í¿Í Àü¸é±¤°í¸¦ ´Þ¾Ò´Âµ¥¿ä ¹è³Ê±¤°í°°Àº °æ¿ì´Â
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GoogleMobileAds.Api;
public class BottomBanner : MonoBehaviour
{
private BannerView bannerView;
public void Start£¨£©
{
// Initialize the Google Mobile Ads SDK.
MobileAds.Initialize£¨initStatus => { }£©;
this.RequestBanner£¨£©;
}
private void RequestBanner£¨£©
{
#if UNITY_ANDROID
string adUnitId = "³» °ÔÀÓ ¹è³Ê±¤°í id ³Ö¾úÀ½";
#elif UNITY_IPHONE
string adUnitId = "ca-app-pub-3940256099942544/2934735716";
#else
string adUnitId = "unexpected_platform";
#endif
// Create a 320x50 banner at the top of the screen.
this.bannerView = new BannerView£¨adUnitId, AdSize.Banner, AdPosition.Bottom£©;
// Create an empty ad request.
AdRequest request = new AdRequest.Builder£¨£©.Build£¨£©;
// Load the banner with the request.
this.bannerView.LoadAd£¨request£©;
}
// Start is called before the first frame update
// Update is called once per frame
void Update£¨£©
{
}
}
ÀÌ·¸°Ô ®°í Àü¸é±¤°í´Â
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using GoogleMobileAds.Api;
public class replay : MonoBehaviour
{
private InterstitialAd interstitial;
public Canvas myCanvas;
private void RequestInterstitial£¨£©
{
#if UNITY_ANDROID
string adUnitId = "³» °ÔÀÓ Àü¸é±¤°í id ³ÖÀ½";
#elif UNITY_IPHONE
string adUnitId = "ca-app-pub-3940256099942544/4411468910";
#else
string adUnitId = "unexpected_platform";
#endif
// Initialize an InterstitialAd.
this.interstitial = new InterstitialAd£¨adUnitId£©;
// Called when the ad is closed.
this.interstitial.OnAdClosed += HandleOnAdClosed;
// Create an empty ad request.
AdRequest request = new AdRequest.Builder£¨£©.Build£¨£©;
// Load the interstitial with the request.
this.interstitial.LoadAd£¨request£©;
}
public void ReplayGame£¨£©
{
RequestInterstitial£¨£©;
//When you want call Interstitial show
StartCoroutine£¨showInterstitial£¨£©£©;
IEnumerator showInterstitial£¨£©
{
while£¨!this.interstitial.IsLoaded£¨£©£©
{
yield return new WaitForSeconds£¨0.2f£©;
}
this.interstitial.Show£¨£©;
myCanvas.sortingOrder = -1;
}
// if £¨this.interstitial.IsLoaded£¨£©£© {
// this.interstitial.Show£¨£©;
// myCanvas.sortingOrder = -1;
// }
// SceneManager.LoadScene£¨"Ready"£©;
}
public void HandleOnAdClosed£¨object sender, System.EventArgs args£©
{
SceneManager.LoadScene£¨"Ready"£©;
}
}
ÀÌ·¸°Ô ÀÛ¼ºÇÔ À§¿¡ canvas.sortingOrder´Â ¾ÈÇϰí Çϸé canvas¿¡ ±¤°í °¡·ÁÁú ¼ö ÀÖ´ÙÇØ¼ ³ÖÀº°Å°í ±¤°í ´ÝÀ¸¸é Ready¶ó´Â ¾ÀÀ¸·Î ³Ñ¾î°¥ ¼ö ÀÖµµ·Ï ³ÖÀº°ÍÀÔ´Ï´Ù.
Ȥ½Ã ³»°¡ § Äڵ忡 ¹®Á¦°¡ ÀÖ³ª¿ä? »ç½Ç admob°¡ÀÔÇÑÁö ¾ó¸¶ ¾È ‰ç°í °áÁ¦Á¤º¸µµ ³ÖÀºÁö ¾ó¸¶ ¾È µÇ¼ Ȥ½Ã ÀÌ°Ô ¹®Á¦°¡ µÉ ¼ö ÀÖ³ª¿ä? ¾ÖÃÊ¿¡ Å×½ºÆ® ±¤°íµµ ¾È ¶ß´Â ÀÌÀ¯°¡ ¹º°¡¿ä?