What happens if we call Advertisement.Load multiple times?

Hello,
When we call Advertisement.Load(unitId), the ad video is downloaded. Right?
I want to know what happens if I call it multiple times? Would it be downloaded again?
I want to know, because I want to consider user network traffic to be minimum.

1 Like

Hi @ddadkhah ,

I’ve just tested using Charles Proxy. It looks like subsequent load calls will cause additional network traffic.

In general, we don’t recommend attempting to load another ad while you already have one loaded.

Have a great day!

2 Likes

Hello @Unity_Quinn ,
I’m also on implementing ads the first time for an app and would like to know if there is any use case to load another ad while we already have one loaded? Are multiple loaded ads buffered and then shown one after each other on consecutive Show calls until they are shown all? Or is there only one ad loaded and then the previous loaded ad is discared on new Load call. Would appreciate a link to any documentation to such toppics if you know if there exists one.
Greetings David

Hi David,

Attempting to load an ad unit that already has an ad loaded is unexpected behavior. My rule of thumb as a support agent is to advise against this as it tends to cause issues, and those issues tend to be difficult to diagnose without seeing someone’s integration code.

When I integrate our ads SDK into a test or hobby project, I will typically place my Load calls in the initialization callback (OnInitializationComplete), and when an ad is finished showing (OnUnityAdsShowComplete). I expect this implementation would be sufficient for most publishers’ use cases.

Our new documentation hub for ads is here: Welcome to Unity Ads
I’d recommend starting with the integration guides and copy/pasting some of the code examples, and making some tweaks from there.

Thanks for your reply @Unity_Quinn ,

I think this part is missing in the docs and could be very useful for others too if it will be added there.

Greetings David

1 Like

hello @Unity_Quinn
I am trying to update my games Ads SDK to 4.0.0 but I am having a similar issue. Here is how I am doing:

        protected AbstractUnityAdsController()
        {
            Advertisement.Initialize(GetGameId(), TestMode, this);
        }

        public string GetGameId()
        {
            return Application.platform == RuntimePlatform.IPhonePlayer ? IosId : AndroidId;
        }

        public void OnInitializationComplete()
        {
            Advertisement.Load(GetIdForPlacementType(AdPlacementType.REWARDED), this);
        }

I am using Unity 2019.4.16f1 and it simply freezes unity. If I remove the Advertisement.Load part, it works properly.
Also, if I invoke Advertisement.Load after 500ms (and in the main thread), it give me these errors:

As you can see, it starts the ads correctly, but after calling Advertisement.Load, for some reason it calls OnInitializationFailed.

Could you help me on this, please?

Ok, I am sorry to bother, it was my bad in the end.
I was using a wrong placement id, and on OnUnityAdsFailedToLoad I was just trying to load again, which caused the freeze (infinite loop). After fixing the placement Id, it worked.

1 Like