Ad isn't using dashboard settings

I was using ads just by enabling it in the Services section of the editor and it worked great.

I then switched over to manually initializing ads in case the user doesn’t have a steady internet connection, it’ll retry until it can connect.

public IEnumerator checkInternetConnection()
    {
        while(!unityAdsInitialized)
        {
            WWW www = new WWW("http://google.com");
            yield return www;
            if (www.error == null)
            {
                #if UNITY_ANDROID
                Advertisement.Initialize(androidGameID); // initialize Unity Ads.
                #elif UNITY_IOS
                Advertisement.Initialize(iosGameID); // initialize Unity Ads.
                #endif
//                print (Advertisement.gameId + " UnityAds Initialized! " +  Advertisement.isInitialized + " is test mode: " + Advertisement.testMode);
              
                unityAdsInitialized = true;

                break;//will end the coroutine
            }
                yield return checkInterval;
        }
    }

And to disable auto initialization I use:

    [PostProcessScene]
    public static void OnPostprocessScene(){
        AdvertisementSettings.enabled = true;
        AdvertisementSettings.initializeOnStartup = false;
    }

Now it ignores the dashboard as well as the id of the ad type and only shows a rewarded ad, I cannot for the life of me get it to recognize a skippable ad.

I made a new ad called “skipper” and I’m debugging out when I call showad that it is trying to show “skipper”. I made “skipper” the default ad in my dashboard and ensured it’s skippable after 0 seconds.

No matter what I do, it shows a 30 second non skippable ad, I even set the default “video” ad to skippable after 0 seconds and it has no effect.

Have you verified you are using correct game id?

If you are using Unity 5.6.1 or above (which has Unity Ads SDK 2.1.0 integrated) you don’t need to manually deal with connectivity issues yourself. Better handling of connection state has been one of parts which has been rewritten for Ads SDK 2.x.

/Rasmus

1 Like

I have, I’m debugging it out right after it initializes with Advertisement.gameId.

I’m using Unity 5.3.7 still for this project.

It was working flawlessly a few days ago. Then I tried to implement heyzap and chartboost, etc but then reverted those changes and am just using unity ads atm. The only real change between when it was working and now is that I’m manually starting initialization after verifying there’s an internet connection.

The other thing that is different now is it used to just show a generic Unity 3d ad during test mode and now it’s showing a full 30 second real ad while debugging out that test mode is set to true.

edit:: Disabled all ads except the one I want and it ignores it, still shows a 30 second non skippable video.

This is my settings in the dashboard:
3118370--235901--adsettings.jpg

Still sounds like you are not initializing with the “correct” game id. In Unity editor, you should see a message like “UnityAdsEditor: Initialize(, False);” in console window, when entering playmode for game. Is that initializing using the right game id?

/Rasmus

I’m re-installing Unity. Is it possible someone can inject their id behind the scenes somehow? I was trying a few different packages like https://github.com/Applifier/unity-ads-helper/wiki, chartboost, heyzapp, etc between when it was working and when it stopped working. I reverted in git afterwards and figured it was good.

3118455--235903--adADB.jpg

The yellow shows correct ad handle and my game ID is 1454318

I had a previous game ID and accidently clicked the COPPA toggle and couldn’t uncheck it so I made a new project ID and swapped in the new ID in the editor. I feel like simply throwing the id in the text field may not have updated entirely over the previous id?

That second yellow field is debugged right after:

in the code and the debug statement is:

Also the services tab in Unity editor will no longer let me disable ads, if I click to disable it says “Can’t disable ads”.

Tested here with your game id and placement id, works. Get the following in console log from editor:
3118470--235905--upload_2017-6-22_20-11-11.png

Instead of the “PostProcessScene hack”, I would recommend that you use Asset Store version of Ads SDK 2.1 from https://www.assetstore.unity3d.com/en/#!/content/66123. Then you also don’t need to handle internet connection yourself, and also don’t risk that engine integrated version of Ads SDK somehow is still initializing Ads.

/Rasmus

Would test mode affect it any? Or could the skip button not be working somehow?

Should I archive the previous projects in services? This project has 3 entries there but I’m only using 1.

I re-imported the Unity Ads off the store, 2.1 version, it didn’t ask me to download so I must have been using the latest version (installed ads last week)

Made sure to disable Ads in the Services tab to get rid of the multiple ShowResult declaration.

I made an empty scene with 2 buttons and a test script:

using UnityEngine;
using System.Collections;
using UnityEngine.Advertisements;
public class TestAds : MonoBehaviour {
    private string androidGameID = "1454318";
    // Use this for initialization
    void Start () {
   
    }

    public void Initialize() {
        Advertisement.Initialize(androidGameID);
        print("Initialized " + Advertisement.isInitialized);
    }

    public void ShowAd() {       
        StartCoroutine("WaitToShow");
    }
    IEnumerator WaitToShow()
    {
        print("Ready: " + Advertisement.IsReady("skipper"));
        while (!Advertisement.IsReady("skipper"))
        {
            yield return null;
        }
        print("Ready: " + Advertisement.IsReady("skipper"));
        print("state " + Advertisement.GetPlacementState("skipper"));
        Advertisement.Show("skipper");
    }

    private void Update()
    {
        if (Advertisement.isInitialized) {
            if (Advertisement.isShowing) {
                print("state " + Advertisement.GetPlacementState("skipper"));
            }
        }
    }
}

Button #1 is Initialize(), and calls Initialize.
Button #2 is ShowAd()

I deploy on device, click initialize, it debugs true for .isInitialized

I then click Show Ad, it shows a 30 second non skippable ad…

If anyone else runs into this, support answered my problem:

This fixed it…