Unity Ads 3.4.0 and canvas - overlay

Hi

I just upgraded Unity Ads SDK to 3.4.0 and also updated my code to use Advertisement instead of Monetization API… (original code used built-in SDK and it worked fine all time)

And I found with this version anything in canvas - overlay mode will be rendered on top of the advertisement view and also caused the close button irresponsible. Did any one encounter this issue before?

Thanks!

Jinni

I just tried used Monetization API, it works without the issue with overlay canvas as above.
Seems this issue only exists in Advertisement API

Also I’m so confused why there are two different APIs with very similar features.

1 Like

I seems the Adv API created a “Placeholder” in the scene to display the fake ad UI and it uses the overlay mode canvas as well. The canvas used to display fake ad has a sorting order of 0 so anything with higher sorting order in overlay space will be above it.

Is it an issue that only happens in Editor mode? (And why does Monetization API work without this issue?)

BTW, when upgraded to 3.4.0 you will get “warning CS0618: ‘Monetization’ is obsolete: ‘Deprecated. Please use Advertisements’”. That’s why I updated my code to use Adv API

This is so annoying, it’s being very confusing working with this Ads packages from Unity.

To begin, they have now 3 places to get the ads from? The asset store has one version, the package manager has 2 versions and I think another version automatically installs when we enable the Ads in the Services panel. I think there might also be another version on github.

Now when I install what I think it’s the last version, the Advertisement Package 3.4.0 from the package manager, it shows this warning that monetization is obsolete.

Then you look at the documentation for this very same package:
https://docs.unity3d.com/Packages/com.unity.ads@3.4/manual/MonetizationBasicIntegrationUnity.html

It says right there :

"Unity’s monetization platform provides you with powerful revenue tools. If your game uses in-app purchases as well as ads, Unity’s machine learning data model can seamlessly blend content types for an optimized monetization strategy. To learn more about how Unity helps you optimize revenue, see documentation on Personalized Placements.

The Unity Ads integration for Personalized Placements is slightly different, as it requires the Monetization API instead of the Advertisements API."

Really?

Are there like 4 different teams working on the same thing at unity? Cause this is getting increasingly confusing, as something that’s supposed to bring some money to Unity (as we’re using Unity Ads) you’d expect that to be more organized.

1 Like

Can’t agree with you more. I’m totally confused by Unity Ads and Unity IAP as well. It’s like there is no project manager is managing the development process inside Unity service team.

When I upgraded to Monetization SDK 3.4.0 from asset store, there is also a warning to suggest me to use Package Manager distribution of Ads SDK instead. (WTF?). And when you checked Package manager, you will find only a SDK of version 2.x is verified by Unity editor, and the newest version are also behind the versions from Asset Store. Well, I remember Unity team member also suggests us to always use “latest version” ,right? Whose suggestion should I follow?

Further more, 3.4.0’s release notes simply says this version “Deprecated Monetization API” without any further explanation. Then what about “Personalized placement” which depends on Monetization API as your document states? Does the Advertisement API also supports the personalized placement from this version so we don’t need Monetization at all? It is so confusing.

Come on, Unity Services team, I know you could do better job than this. I fully understand it’s not an easy job to provide robust Services API for your customers. But at least you could make things more clear by answering our questions. And please hire a project manager. THANK YOU.

1 Like

To help clarify, the asset store and the package manager distributions are the same. You will find 3.4.0 on both asset store and in package manager. You should only install it from one of these sources, installing from both will cause issues due to having duplicate copies of the same code in your project. Package manager is the future distribution channel for the ADS SDK and is why you will see messages informing you to upgrade to that distribution channel. For older versions of unity we still distribute via the asset store.

Thanks, that’s what I’ve been using, but that package (Advertisement 3.4.0) says that Monetization is obsolete(deprecated), and the documentation says that if we want to use Integration for Personalized Placements we have to use the Monetization API as it is not part of Advertisement.

So what do we have to use?

Thanks for the clarification. Is there a simple way to remove Unity Ads SDK installed from asset store entirely? I’d like to do a clean install of the SDK from Package Manager.

Regarding the overlay canvas issue and the Monetization class thing, would you please help to clarify?

There is no simple button to click to remove the asset store files, but you can delete the UnityAds folder in your asset folder along with the android and ios plugins it installs. To get an idea of the total files you need to remove, you can look at the package preview when viewing the asset on the asset store. That will tell you all the files it installs, and you can just remove those files from your project, then install via the package manager.

Re: the canvas issue. Thats something I will look at soon, but we changed how the placeholder image was being drawn in the editor in 3.4 and its likely an issue to do with not making sure the placeholder is drawn on top of everything else. I will try and take a look today or tomorrow and get a fix into the next patch release. This issue will only be an issue in editor, as on device rendering did not change in this release.

Re: Monetization. We are planning to fully remove the monetization namespace in favor of a singular namespace advertisements. We will have a migration path for those using Personalized Placements, and you can expect additional details and guidance around this early in the new year.

2 Likes

There is another issue, the Close button from the placeholder does not properly call the IUnityAdsListener interface OnUnityAdsDidFinish method, I believe the previous version properly called the callback we registered on the end event of a video when we used the old method.

Thank you for clarifying this.

Same thing happened here, I’m temporarily going to “fix” it like that:

Call the advertisement :

Advertisement.Show(rewardedVideo);

#if UNITY_EDITOR
            this.StartCoroutine(this.FixCanvas());
#endif

The coroutine:

#if UNITY_EDITOR
    private IEnumerator FixCanvas()
    {
        yield return new WaitForSeconds(.25f);
        if (GameObject.Find("Placeholder/Canvas(Landscape)") != null)
        {
            GameObject.Find("Placeholder/Canvas(Landscape)").GetComponent<Canvas>().sortingOrder = 100;
        }

        if (GameObject.Find("Placeholder/Canvas(Portrait)") != null)
        {
            GameObject.Find("Placeholder/Canvas(Portrait)").GetComponent<Canvas>().sortingOrder = 100;
        }

        // have to call the interface ourselves because the placeholder close button does not do it...
        this.OnUnityAdsDidFinish(rewardedVideo, ShowResult.Finished);
    }
#endif
1 Like

Thanks man, really appreciate it

Cool. This should work as a walkaround for testing purpose now. The sorting order could be 32767 since it’s the largest sorting order as possible.

Hi,

So i keep getting the same deprecation warning for Monetization api. But when i try to use the advertisement api for interstitial ads it gives me an error like this:

UnityEngine.Advertisements.Platform.Editor.EditorPlatform.Show (System.String placementId) (at Library/PackageCache/com.unity.ads@3.4.0/Runtime/Advertisement/Platform/Editor/EditorPlatform.cs:164)
UnityEngine.Advertisements.Platform.Platform.Show (System.String placementId, UnityEngine.Advertisements.ShowOptions showOptions) (at Library/PackageCache/com.unity.ads@3.4.0/Runtime/Advertisement/Platform/Platform.cs:104)
UnityEngine.Advertisements.Advertisement.Show (System.String placementId) (at Library/PackageCache/com.unity.ads@3.4.0/Runtime/Advertisement/Advertisement.cs:142)
AdManager.Update () (at Assets/scripts/AdManager.cs:48)

I’ve tried DontDestroyOnLoad(this.gameObject) to make sure the gameObject is not destroyed but i am still getting this error.

@shankyemcee That doesn’t appear to be a complete stacktrace so im not sure what the actual error is other than its happening on line 164 of EditorPlatform. Could you please start a new issue with complete details about your unity version, the full stacktrace with error message, and any other details you can provide. Thanks