- Home /
Unity ads not initializing automatically ?
i am using unity reward based ads in my android/ios game. but when i check it
always return false because in ads script if check in Awake unity ads initialization is falseAdvertisement.IsReady (rewardVideoID)
void Awake ()
{
Debug.Log ("Unity ads ini state : " + Advertisement.isInitialized); //it is false everytime
}
here i want to know why unity ads are not auto initializing. i used unity ads in my previous project it is initializing automatically
Answer by venezuelanroads · Apr 09, 2017 at 05:32 AM
Well, I had the same problem, I think that's a bug. I fixed it by initializating it manually.
You can add this to your ad manager, or just create a new one:
using UnityEngine;
using UnityEngine.Advertisements;
public class UnityAdsInitializer : MonoBehaviour
{
[SerializeField]
private string
androidGameId = "18658",
iosGameId = "18660";
[SerializeField]
private bool testMode;
void Start ()
{
string gameId = null;
#if UNITY_ANDROID
gameId = androidGameId;
#elif UNITY_IOS
gameId = iosGameId;
#endif
if (Advertisement.isSupported && !Advertisement.isInitialized) {
Advertisement.Initialize(gameId, testMode);
}
}
}
;D
Thanks! Although it worked previously (I think it was with automatic initialization), I had to manually set the GameIds in this way, and it worked for me in Unity 2017.1
Answer by wallacewakko · Aug 30, 2018 at 07:43 PM
Had to thank you since you give the clue I need to find the problem I was having with Heyzap and UnityAds. Basically I was implementing the Heyzap SDK on an old project, with have using only the UnityAds. All the other services I implemented was dispatching the events for rewarded videos, except UnityAds.
The point is: In the Projects/UnityConnectSettings the connection for me was set to initialize automatically, and the Services component in Unity doens't show to you anything about this on Unity 2017.4.6f. I was searching for something for 4 days to solve this problem, until I reach this topic. I was not using Advertisement.Initialize anymore like you, but I remember that Unity could start automatically and them I could figure out the problem.
Heyzap Dashboard doesn't have nothing about this, on internet nobody said anything about it, so I'm just making this registration for history. Thanks. :)
Your answer
Follow this Question
Related Questions
Need help to select Unity3d publishing for iOS and android 1 Answer
Unity Build stops some of the working functionalities. 0 Answers
Unity Pro 4.6.8 MAC OSX El Capitan Last version of XCODE and Facebook SDK 0 Answers
unable to merge android manifests 0 Answers
Activating all powerups at once is glitching my powerups 0 Answers