- Home /
Unity ads - show ad once ready
I'm trying to implement rewarded video ads in my game using both unity ads and admob. For admob, once the ad is ready, the watch ad button's interactibality is set to true.This works properly for admob but I'm unable to implement the same in unity ads. Here is the admob code:
public class GoogleAdmobScript : MonoBehaviour
{
string Video_Ad_Id = "ca-app-pub-3940256099942544/5224354917";
private RewardedAd rewardedAd;
public Button watchAdBtn;
void Start()
{
MobileAds.Initialize(initStatus => { });
RequestRewardBasedVideo();
}
void Update()
{
if (rewardedAd.IsLoaded())
{
watchAdBtn.interactable = true;
}
}
This is what I have in the UnityAds script:
public class UnityAdsManager : MonoBehaviour, IUnityAdsListener
{
string Unity_ID = "123456";
bool test_mode = true;
string myPlacementId = "rewardedVideo";
public Button unityAdBtn;
void Start()
{
Advertisement.AddListener(this);
Advertisement.Initialize(Unity_ID, test_mode);
}
void Update()
{
if (Advertisement.IsReady(myPlacementId))
{
unityAdBtn.interactable = true;
}
}
The unity ad button is always greyed out. Not sure what's going wrong. Can someone please help?
Answer by arvindchetu · Sep 18, 2020 at 04:17 PM
If everything is fine from Unity editor side, you should check “Advertisement.Initialize(Unity_ID, test_mode);” response.
if (Advertisement.IsReady(myPlacementId)) never got true then the issue is with Unity ad somewhere. But if if is true then something is wrong in your project from unity editor side.
You should check for others scripts as well may be some other script is making it interacted false.
Your answer
Follow this Question
Related Questions
Admob, Unity Ads, and Google Play Services 0 Answers
unity app crashes when admob banner ad is requested but works fine for interstitial and video ad 0 Answers
Unity Ads AdMob Mediation Setup 0 Answers
Non-game app and Unity Ads vs AdMob 0 Answers
Does Unity Ads or Admob pay the developer if user just watch a rewarded videos ?? 0 Answers