Why do I get a "'Advertisements' does not exist in the namespace 'UnityEngine' error"?

This error is caused by one of two issues:

  • You are building for a platform that is not supported by Unity Ads
  • You haven't enabled Unity Ads for your Project yet.

Try the following to resolve the problem:

  • Ensure that Unity Ads is toggled ON in the Services window (Window > Services).
  • Ensure that you've selected iOS or Android as a build target (File > Build Settings...).
  • If you're building your Project for an unsupported platform, you can add a UNITY_ADS conditional define that allows you to build with Unity Ads without affecting other platforms.

For more information, see documentation on platform dependent compilation.

Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request


  • 0

    I did all those things and I still get that error, but only when I try to build.

  • 0
    Unity Ads Support

    Hi Matt,

    I am sorry that this is happening.

    Please, can you submit a support ticket to

    Thank you.

    Kind Regards


  • 0
    hameed ullah jan

    may be it's too late to answer but, it can be solved by following these steps:

    -close unity (save your project)

    -go to project settings folder under the your project directory

    - delete these two files 1. UnityAdsSettings.assets 2. UnityConnectionSettings.assets

    -now re-open your project and turn on unity ads under services, you will not see the error again. 

  • 0
    Gravity Games

    it does not work for me. do you have other solution?

Article is closed for comments.