2017-04-04 26 views
1

내 안드로이드/iOS 게임에서 화합 보상 기반 광고를 사용하고 있습니다. 하지만 내가 그것을 확인할 때 Advertisement.IsReady (rewardVideoID);유니티 광고가 자동으로 초기화되지 않습니까?

항상 false를 반환합니다.

또한 깨어 연합 광고 초기화에 체크

void Awake() 
{ 
    Debug.Log ("Unity ads ini state : " + Advertisement.isInitialized); //it is false everytime 
} 

거짓이면하지만 내가 단결 광고가 자동으로 초기화하지 않은 이유를 알고 싶어 그래서 여기 유니티 에디터에서 광고를 사용할 수있다. 이전 프로젝트에서 자동으로 초기화되는 화합 광고를 사용했습니다.

답변

0

Advertisement.isInitialized 또는 Advertisement.IsReady을 확인하기 전에 Advertisement.Initialize으로 전화해야합니다.

그 뿐만이 아닙니다. Advertisement.Initialize으로 전화를 걸면 즉시 초기화된다는 보장은 없습니다. 따라서 coroutine 함수에서이 검사를 수행해야 초기화가 완료 될 때까지 계속 검사 할 수 있습니다. Unity's Ads Doc에서

예 :

IEnumerator Start() 
{ 
!UNITY_ADS // If the Ads service is not enabled... 
    if (Advertisement.isSupported) 
    { // If runtime platform is supported... 
     Advertisement.Initialize(gameId, enableTestMode); // ...initialize. 
    } 
if 

    // Wait until Unity Ads is initialized, 
    // and the default ad placement is ready. 
    while (!Advertisement.isInitialized || !Advertisement.IsReady()) 
    { 
     yield return new WaitForSeconds(0.5f); 
    } 

    // Show the default ad placement. 
    Advertisement.Show(); 
} 
+0

하지만 단결에 따라 통일의 최신 버전을 사용하면 편집기에서 사용할 자동 초기화와 UnityAds를 사용하는 경우 그렇지 –

+0

을 초기 환경 수동으로 필요하지 않습니다. 내 대답의 목적은'Advertisement.isInitialized'와'Advertisement.IsReady'가 즉시 true로 바인딩되지 않는다는 것입니다. 'Update' 함수에서 끊임없이 체크하거나 coroutine과 while 루프를 사용해야합니다. – Programmer