Skip to content

Instantly share code, notes, and snippets.

@yasuyuki-kamata
Created February 6, 2015 08:41
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/fd58f227b41beee98af9 to your computer and use it in GitHub Desktop.
Save yasuyuki-kamata/fd58f227b41beee98af9 to your computer and use it in GitHub Desktop.
UnityAds の呼び出しサンプルコード
using System.Collections;
using UnityEngine.Advertisements;
public class UnityAdsManager : MonoBehaviour
{
static UnityAdsManager _instance;
/// <summary>
/// Get instance.
/// </summary>
/// <returns>The instance.</returns>
public static UnityAdsManager GetInstance () {
if (null == _instance) {
GameObject go = new GameObject ("UnityAdsManager");
_instance = go.AddComponent<UnityAdsManager>();
}
return _instance;
}
[SerializeField]
string appId = "14775";
public void Init () {
if (Advertisement.isSupported) {
Advertisement.Initialize(appId);
}
}
public void ShowAds () {
if (Advertisement.isReady()) {
Advertisement.Show();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment