I have a game which is live on App Store and Google Play. Video ads work on both apps. They were built on Mac with Unity 2018.2.18. Now when I try to build for Android and iOS, ads don’t work, and here is what I’m doing.
I upgraded Unity to 2018.2.21f1. I decided to keep Unity 2018.2 because most of my scripts are in UnityScript. I know that’s legacy, but time is crucial now and besides Monetization 3.0.3 is supposed to be working with it.
I open the backed-up project (the one that works on both stores). It is imported succesfully from 2018.2.18 version. In Packages/manifest.json it says "com.unity.ads": "2.0.8", which is in fact the version that was used in the build.
I Build&Run it for Android as is, deploy it on the device and the video ads don’t show anymore. In Editor, everything seems to be working fine.
When I open Services/Ads, I get the warning that I should update Unity Ads to the latest version or re-enable the internal Ads extension.
I first try to re-enable the internal ads extension. Build fails with:
I then turn off built-in Ads Extension, and I get the same message in Services/Ads - to import the latest Unity Ads plugin from the asset store.
I first try to update it via Package Manager, which shows that I have “Ads” package 2.0.8. and offers the update to 2.3.1. I update it and that seems to succeed as the name of the package changes to “Advertisement” and Packages/manifest.json now says "com.unity.ads": "2.3.1", but I get the following error in the console:
error CS1704: An assembly with the same name `UnityEngine.Advertisements.Editor' has already been imported. Consider removing one of the references or sign the assembly
Assets/UnityAds/UnityEngine.Advertisements.Editor.dll (Location of the symbol related to previous error)
/Users/momcilo/Library/Unity/cache/packages/packages.unity.com/com.unity.ads@2.3.1/Runtime/UnityEngine.Advertisements.Editor.dll (Location of the symbol related to previous error)
Following some advices I found on the internet, I did Assets/Reimport All to solve this issue. It didn’t help and I still get the same error as in 7.
I then went to Asset Store, found Monetization 3.0.3 and tried to import it. It apparently succeeded, but the errors remained the same, and Packages/manifest.json still states "com.unity.ads": "2.3.1".
Following advice from one of the forum posts, I wanted to delete the Advertisement package from Package Manager, but… Package Manager wasn’t there anymore?! I gave up at this point.
I am completely confused as to what to do from this point on. Ideally:
I would like to keep Unity 2018.2.21f1 because switching to C# now would be hell as I need to update the game quickly.
I understand that ads now require the latest API from Monetization 3.0.3, but I also see that Monetization 3.0.3 is supposed to support even Unity 5.6.6.
I need to update the game without affecting the video ads functionality.
How can I upgrade Unity Ads from the version I used in the apps that are on stores ( "com.unity.ads": "2.0.8"
) to leverage the current API? As you can see, I have tried lots of different things, but none of it seems to work.
Hello @momcil0 ,
I will skip some details and will try to provide the action points.
First of all, remove the Monetization 3.0.3(Asset Store) package from your project, afterward, disable Ads from Service Window.
At this point, you will have a lot of compiler errors inside a Console Window. Open inside your project folder Packages/manifest.json and delete com.unity.ads dependency. Reimport the project and import Monetization 3.0.3 from Asset Store again.
Let me know if it will solve your issue.
Hello @DenisasK
Thanks you for being so quick to respond. I believe that it could have went the way you suggested to go around the problem, because I did something similar (prior to seeing your response) and I managed to solve the problem. Just for the sake of diligence, I will compile the whole solution here, and just mention that I based my actions on this post.
I disabled Ads from Services
I removed the Ads package from the Package Manager. This step removed com.unity.ads from the manifest.json as well.
I just opened the contents of Monetization 3.0.3 and noted where it would place its files. Then I canceled import and first deleted manually all the files that were in places where Monetization 3.0.3 was about to place its files.
I imported Monetization 3.0.3 from the Asset Store and there were no errors. The manifest.json file did not get updated, and I did not turn the Ads back on in Services - it seemed to work fine in Editor.
In addition to that, I went through this article and made sure I replace all the instances of Advertisement.IsReady() with Monetization.IsReady() - that required adjusting other types and many other lines of code to solve ambiguities between what’s in Monetization, Advetisements and Purchasing.
After the code worked in the Editor and I was able to successfully deploy it to an Android device, I turned the Ads back on in Services and turned off the built-in ads extension. It still worked and it appears it works now as well.
tried various googled options, none worked or gave rise to other issues. fixed it by upgrading unity, removing old ads version and my ads code. updating to 2019.3 with latest unity-ads from package manager, and fresh implementation. now works. but a pain to get there.