アプリ広告といえばGoogle AdMobの情報ばかりが出てきますが、今回はUnityで作ったゲームにUnity Adsを使ってみたので、導入方法を備忘録兼ねて書きたいと思います。
- MacBook Pro (13-inch, M1, 2020) macOS Monterey バージョン12.4
- Ads Package Version 3.7.5
- Unity 2021.3.11f Personal
- Android Studio Dolphin 2021.3.1
Unityの公式ドキュメントも参照してみてください。https://docs.unity.com/ads/CreatingUnityProjects.html
Unity環境設定
本記事では、Unity Adsを導入するためのUnityの設定からGame IDの取得までの行程を記載します。
Unity プロジェクトの作成 / Unity でのビルド ターゲットの設定
Unityで新規プロジェクトを作成する。プラットフォームはiOSまたはAndroidに設定する。すでにゲームを作成している場合は、File > Build Settings を開き、プラットフォームを iOS または Android に設定し、Switch Platformを選択する。

Unity SDK のインストール

Unityの上のタブから Window > Package Manager を開いて、Advertisementを開き、右下のボタンをクリックしてインストールする。 インストール済みの場合はRemoveとなっているので何もしなくて良い。(Updateがある場合はした方が良いです。)
UnityAdsの有効化

Unityの上のタブから Window > General > Services を選択し、画面上にServicesタブを開く(赤枠)。
AdsがOFFになっていると思うので、クリックしてONにし、有効化する(青枠)。

Project Settingが開くので、DashBoardをクリックするとUnity Gaming Serviceのサインイン画面が表示される。
Unity Gaming Serviceにサインイン
Unity Gaming Serviceにサインインする。Unity IDを持っていない人は登録する。
サインインすると以下の画面が表示される。

UnityのProjectからダッシュボードを開いた場合、すでにそのProjectの名前でAd Units(広告ユニット)が作られている(私は勝手に作られていました)。
画面左側のメニューから Monetization > Ad Units よりこの画面を確認できる。
もしAd Unitsが作られていない場合は Projects > Projects で右側のCreate projectから作成する。

GameIDを確認する

この後の行程で赤枠に記載のGameIDが必要になるので控えておくか、この画面を閉じないようにする。
UnityにGameIDを入力

作成したGameIDをProjectSettingsのAdsに入力する。( Edit > Project Settings > Ads )
ついでにTest modeを有効にしておく。これでテスト用広告が表示されるようになる。
コメント