Skip to content

Instantly share code, notes, and snippets.

@yasuyuki-kamata
Created April 13, 2015 22:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yasuyuki-kamata/5ecefe82dfc766bc0551 to your computer and use it in GitHub Desktop.
Save yasuyuki-kamata/5ecefe82dfc766bc0551 to your computer and use it in GitHub Desktop.
[Unity Ads]動画広告の表示 基本的なコーディング
using UnityEngine;
using System.Collections;
using UnityEngine.Advertisements; // Unity Ads を使うための宣言
public class UnityAdsSample : MonoBehaviour
{
public string gameID;
void Awake ()
{
if (Advertisement.isSupported) { // プラットフォームがサポートしているかどうか
Advertisement.Initialize (gameID); // Unity Ads の初期化
}
}
public void ShowUnityAds ()
{
if (Advertisement.isReady ()) { // 準備ができていたら
Advertisement.Show (); // 広告を表示
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment