수색…


소개

이 주제는 Unity Ads 또는 Google AdMob과 같은 타사 광고 서비스를 Unity 프로젝트에 통합하는 것에 대한 내용입니다.

비고

이는 Unity Ads 에도 적용됩니다.

개발하는 동안 Unity Ads의 테스트 모드가 활성화되어 있는지 확인하십시오.

개발자는 자신의 게임에서 광고를 클릭하여 노출 수 또는 설치 수를 생성 할 수 없습니다. 그렇게하면 유니티 광고 서비스 이용 약관에 위배되며, 유니 세이 광고 네트워크에서 사기 시도를 금합니다.

자세한 내용은 Unity Ads 서비스 약관을 읽으십시오.

C #의 유니티 광고 기초

using UnityEngine;
using UnityEngine.Advertisements;

public class Example : MonoBehaviour
{
    #if !UNITY_ADS // If the Ads service is not enabled
    public string gameId; // Set this value from the inspector
    public bool enableTestMode = true; // Enable this during development
    #endif

    void InitializeAds () // Example of how to initialize the Unity Ads service
    {
        #if !UNITY_ADS // If the Ads service is not enabled
        if (Advertisement.isSupported) { // If runtime platform is supported
            Advertisement.Initialize(gameId, enableTestMode); // Initialize
        }
        #endif
    }
    
    void ShowAd () // Example of how to show an ad
    {
        if (Advertisement.isInitialized || Advertisement.IsReady()) { // If the ads are ready to be shown
            Advertisement.Show(); // Show the default ad placement
        }
    }
}

자바 스크립트의 유니티 광고 기초

#pragma strict
import UnityEngine.Advertisements;

#if !UNITY_ADS // If the Ads service is not enabled
public var gameId : String; // Set this value from the inspector
public var enableTestMode : boolean = true; // Enable this during development
#endif

function InitializeAds () // Example of how to initialize the Unity Ads service
{
    #if !UNITY_ADS // If the Ads service is not enabled
    if (Advertisement.isSupported) { // If runtime platform is supported
        Advertisement.Initialize(gameId, enableTestMode); // Initialize
    }
    #endif
}

function ShowAd () // Example of how to show an ad
{
    if (Advertisement.isInitialized && Advertisement.IsReady()) { // If the ads are ready to be shown
        Advertisement.Show(); // Show the default ad placement
    }
}


Modified text is an extract of the original Stack Overflow Documentation
아래 라이선스 CC BY-SA 3.0
와 제휴하지 않음 Stack Overflow