ドキュメント

​
​

Development

User Acquisition

Monetization

産業

Unity Ads Monetization

Unity Ads Android SDK

Unity Ads iOS SDK

Unity Ads SDK

Unity Ads Monetization

Unity Ads Monetization
​
​
Unity 開発者ガイド
  • Unity SDK の概要
  • Unity Ads SDK for Unity のインストール
  • Unity での SDK の初期化
  • Unity でのインタースティシャル広告の実装
  • Unity でのリワード広告の実装
  • Unity でのバナー広告の実装
Unity Ads API リファレンス
  • Unity Ads for Unity API リファレンス (C#)
  1. ゲームの成長
  2. Unity Ads
  3. Unity 開発者向け Unity Ads SDK インテグレーションガイド

Unity でのバナー広告の実装

Unity プロジェクトにバナー広告を実装します。広告コンテンツをロードし、C# スクリプトを使用して画面上の固定位置に表示します。
読み終わるまでの所要時間 4 分
最終更新 6日前

注
SDK バージョン 4.4.1 から、Unity Ads パッケージは Unity エディターで Advertisement Legacy パッケージと呼ばれるようになりました。 Advertisement Legacy パッケージのバージョン 4.12 は引き続き機能しますが、新機能や拡張機能のアップデートを受けることはできません。 SDK バージョン 4.12 では Apple プライバシーマニフェストの更新がサポートされており、パッケージの更新は今後予定されていません。
重要
app-ads.txt は、詐欺に対処し広告エコシステムに透明性をもたらす IAB イニシアチブです。記載されているとおりに app-ads.txt を実装してください。そうしないと、バナーの需要が大幅に減るおそれがあります。

スクリプトの実装

スクリプトのヘッダーで、
Banner
クラスを含む
UnityEngine.Advertisements
名前空間を宣言します。次に、SDK を初期化し、
Banner.Load
メソッドと
Banner.Show
メソッドを使用して、バナー広告をロードして表示します。
以下のスクリプト例は、シーン内にボタンを設定してこの機能をテストする方法を示します。Unity エディターでボタンを作成するには、Game Object (ゲームオブジェクト) > UI > Button (ボタン) を選択します。
注
コンテンツのロードは、SDK が初期化された後にのみ行います。そうしないと、スクリプトは動作しません。この例では、初期化は別のスクリプトでハンドルされています。

バナー広告の例

using UnityEngine;using UnityEngine.UI;using UnityEngine.Advertisements;public class BannerAdExample : MonoBehaviour{ // For the purpose of this example, these buttons are for functionality testing: [SerializeField] Button _loadBannerButton; [SerializeField] Button _showBannerButton; [SerializeField] Button _hideBannerButton; [SerializeField] BannerPosition _bannerPosition = BannerPosition.BOTTOM_CENTER; [SerializeField] string _androidAdUnitId = "Banner_Android"; [SerializeField] string _iOSAdUnitId = "Banner_iOS"; string _adUnitId = null; // This will remain null for unsupported platforms. void Start() { // Get the Ad Unit ID for the current platform: #if UNITY_IOS _adUnitId = _iOSAdUnitId; #elif UNITY_ANDROID _adUnitId = _androidAdUnitId; #endif // Disable the button until an ad is ready to show: _showBannerButton.interactable = false; _hideBannerButton.interactable = false; // Set the banner position: Advertisement.Banner.SetPosition(_bannerPosition); // Configure the Load Banner button to call the LoadBanner() method when clicked: _loadBannerButton.onClick.AddListener(LoadBanner); _loadBannerButton.interactable = true; } // Implement a method to call when the Load Banner button is clicked: public void LoadBanner() { // Set up options to notify the SDK of load events: BannerLoadOptions options = new BannerLoadOptions { loadCallback = OnBannerLoaded, errorCallback = OnBannerError }; // Load the Ad Unit with banner content: Advertisement.Banner.Load(_adUnitId, options); } // Implement code to execute when the loadCallback event triggers: void OnBannerLoaded() { Debug.Log("Banner loaded"); // Configure the Show Banner button to call the ShowBannerAd() method when clicked: _showBannerButton.onClick.AddListener(ShowBannerAd); // Configure the Hide Banner button to call the HideBannerAd() method when clicked: _hideBannerButton.onClick.AddListener(HideBannerAd); // Enable both buttons: _showBannerButton.interactable = true; _hideBannerButton.interactable = true; } // Implement code to execute when the load errorCallback event triggers: void OnBannerError(string message) { Debug.Log($"Banner Error: {message}"); // Optionally execute additional code, such as attempting to load another ad. } // Implement a method to call when the Show Banner button is clicked: void ShowBannerAd() { // Set up options to notify the SDK of show events: BannerOptions options = new BannerOptions { clickCallback = OnBannerClicked, hideCallback = OnBannerHidden, showCallback = OnBannerShown }; // Show the loaded Banner Ad Unit: Advertisement.Banner.Show(_adUnitId, options); } // Implement a method to call when the Hide Banner button is clicked: void HideBannerAd() { // Hide the banner: Advertisement.Banner.Hide(); } void OnBannerClicked() { } void OnBannerShown() { } void OnBannerHidden() { } void OnDestroy() { // Clean up the listeners: _loadBannerButton.onClick.RemoveAllListeners(); _showBannerButton.onClick.RemoveAllListeners(); _hideBannerButton.onClick.RemoveAllListeners(); }}

バナーの位置

デフォルトでは、バナー広告は画面の下部中央に固定して表示され、320 x 50 または 728 x 90 ピクセルの解像度がサポートされています。バナーのアンカーを指定するには、
Banner.SetPosition
API を使用します。例を次に示します。
Advertisement.Banner.SetPosition (BannerPosition.TOP_CENTER);
次のステップ: 収益化戦略 ガイドを確認し、実装をテスト します。

Copyright © 2026 Unity Technologies
法規事項プライバシーポリシークッキーDocumentation Terms of Use私の個人情報を販売または共有しないプライバシーに関する選択 (クッキー設定)

"Unity" の名称、Unity のロゴ、およびその他の Unity の商標は、米国およびその他の国における Unity Technologies またはその関係会社の商標または登録商標です (詳しくはこちら)。その他の名称またはブランドは該当する所有者の商標です。

一部のページは利便性向上のため機械翻訳を使用しており、内容に不正確な表現が含まれる場合があります。内容に齟齬または不一致が生じた場合は、英語版を正本とします。

  • このページ
    • スクリプトの実装

      • バナー広告の例

    • バナーの位置


このページの問題を報告する