More Related Content
Similar to Unity Ads Helper の使い方 (20)
More from Yasuyuki Kamata (20)
Unity Ads Helper の使い方
- 4. using UnityEngine;
using UnityEngine.Advertisements;
public classUnityAdsSample: MonoBehaviour
{
void Start()
{
if (Advertisement.isSupported && !Advertisement.isInitialized) {
Advertisement.Initialize("1072596");
}
}
public void ShowAd()
{
if (Advertisement.IsReady()) {
Advertisement.Show();
}
}
}
- 9. • Unity Ads Helper を Github から探して README.md に書いてあるURLから
unitypackage をダウンロード
• 注意:2016年5月23日時点では、develop ブランチから持ってくること!
• https://github.com/Applifier/unity-ads-helper/tree/development
• ダウンロードした unitypackage をインポート
- 10. • Edit -> Unity Ads Settings を選択し、設定ファイルを作成する
• Resources/UnityAdsSettings という名前の SctiptableObject が作られる
- 11. • Servicesウィンドウに表示される Game ID を使う場合
はこのまま。
• そうでない場合は「Override initialization of Ads
Service」にチェックをいれて使用するGame IDを入力
• 必要なログレベルにチェックを入れる
- 15. • Unity Ads Button コンポーネントの Cooldown Time に
クールダウンまでの時間(秒)を入力する
- 16. • Unity Ads Button コンポーネントの各UnityEvent
に任意の処理を登録
• OnFinished() - 動画視聴完了時に呼ばれる
• OnSkipped() - 動画視聴スキップして完了時に呼ばれる
• OnFailed() - 動画視聴失敗時に呼ばれる
- 17. public class UnityAdsSample : MonoBehaviour
{
/** 中略 **/
public void SomethingToDoWhenFinishedAd ()
{
Debug.Log ("Finished", this);
}
public void SomethingToDoWhenSkippedAd ()
{
Debug.Log ("Skipped", this);
}
public void SomethingToDoWhenFailedAd ()
{
Debug.Log ("Failed", this);
}
}