CC 2.3.3 UnityAds not working

Hi,

I’m having trouble on unity ads.
Working with Cocos Creator 2.3.3 imported sdkbox with staging server option.
I use SDKBox Ads for AdMob+UnityAds. AdMob works perfectly but UnityAds doesn’t. I’ve also tried to use sdkbox.PluginUnityAds itself rather than PluginSdkboxAds but still can’t get any test ads or even debug log despite I enabled debug mode.

I’ve tried to import all plugins also .
image

Here is config:

Unity Dashboard:

Here is code:

initAllPlugins(){
    // ADS
    this.initPluginSdkboxAds();
},

// ADS ======================================
initPluginSdkboxAds(){
    if (typeof sdkbox == 'undefined') {
        cc.log('sdkbox is undefined');
        this.Ads_Initialized = false;
        return;
    }

    if (typeof sdkbox.PluginSdkboxAds == 'undefined') {
        cc.log('sdkbox.PluginSdkboxAds is undefined');
        this.Ads_Initialized = false;
        return;
    }

    sdkbox.PluginSdkboxAds.setListener({
        onAdAction : function(ad_unit_id, place, action_type) {

              // AdMob interstitial
            if( ad_unit_id == "AdMob" && place == "interstitial" && 
            ( action_type == AD_ACTION_TYPE.AD_ENDED || action_type == AD_ACTION_TYPE.AD_CANCELED) ){

                smsg.Monetization_Control.node.emit("ad_show_completed") // Emit event 

            } // UnityAds video (interstitial)
            else if( ad_unit_id == "UnityAds" && place == "video" &&  
            ( action_type == AD_ACTION_TYPE.AD_ENDED || action_type == AD_ACTION_TYPE.AD_CANCELED) ){

                smsg.Monetization_Control.node.emit("ad_show_completed") // Emit event 

            } // Chartboost interstitial
            else if( ad_unit_id == "Chartboost" && place == "interstitial" &&  
            ( action_type == AD_ACTION_TYPE.AD_ENDED || action_type == AD_ACTION_TYPE.AD_CANCELED) ){

                smsg.Monetization_Control.node.emit("ad_show_completed") // Emit event 

            } // UnityAds rewardedVideo
            else if( ad_unit_id == "UnityAds" && place == "rewardedVideo" &&  
            ( action_type == AD_ACTION_TYPE.AD_ENDED ) ){

                smsg.Monetization_Control.node.emit("video_reward_achieved") // Emit event 

            }

            cc.log("onAdAction:" + String(ad_unit_id) + ":" + String(place) + ":" + String(action_type));

        },
        onRewardAction : function(ad_unit_id, place, reward_amount, reward_succeed) {

            
            if( ad_unit_id == "AdMob" && place == "rewarded_video" &&  reward_succeed == true ){ // AdMob rewarded_video
    
                smsg.Monetization_Control.node.emit("video_reward_achieved") // Emit event 
                
            }else if( ad_unit_id == "Chartboost" && place == "rewarded_video" &&  reward_succeed == true ){ // Chartboost rewarded_video
    
                smsg.Monetization_Control.node.emit("video_reward_achieved") // Emit event 
    
            }
    
            cc.log("onRewardAction:" + String(ad_unit_id) + ":" + String(place) + ":" + String(reward_amount) + ":" + String(reward_succeed));
        }
    });
    sdkbox.PluginSdkboxAds.init();
    this.Ads_Initialized = true;
},

Interstitial_Available(){
    if(!this.Ads_Initialized){
        return false;
    }
    if(sdkbox.PluginSdkboxAds.isAvailable("interstitial")) {
        return true;
    }else{
        return false;
    }
},

Show_Interstitial() {
    if(!this.Ads_Initialized){
        return false;
    }
    if(sdkbox.PluginSdkboxAds.isAvailable("interstitial")) {
        sdkbox.PluginSdkboxAds.placement("interstitial");
    }else{
        cc.log(placement + ' is not available');
    }
},

Rewarded_Video_Available(){
    if(!this.Ads_Initialized){
        return false;
    }
    if(sdkbox.PluginSdkboxAds.isAvailable("rewarded_video")) {
        return true;
    }else{
        return false;
    }
},

Show_Rewarded_Video() {
    if(!this.Ads_Initialized){
        return false;
    }
    if(sdkbox.PluginSdkboxAds.isAvailable("rewarded_video")) {
        sdkbox.PluginSdkboxAds.placement("rewarded_video");
    }else{
        cc.log(placement + ' is not available');
    }
},

Help please :slight_smile:

@yinjimmy do you have any ideas?

Let me check it today.

1 Like

i tried unityads, and can show ad success, do you got errors?

maybe you can compare with this sample proejct

I have the same problem, do you managed to make UnityAds work?