Search Unity

Namespace Advertisements does not exist in UnityEngine

Discussion in 'Unity Ads' started by Ali_Akbar_Montazeri, Sep 10, 2015.

Thread Status:
Not open for further replies.
  1. Ali_Akbar_Montazeri

    Ali_Akbar_Montazeri

    Joined:
    Dec 6, 2014
    Posts:
    168
    Hi guys.. so when i was trying this https://github.com/Applifier/unity-ads-demo i go an error
    Code (CSharp):
    1. Assets/SpaceAds/Scripts/UnityAdsHelper.cs(10,19): error CS0234: The type or namespace name `Advertisements' does not exist in the namespace `UnityEngine'. Are you missing an assembly reference?
    2.  
    why the namespace doesn't exist ? and when i clicked that script, it won't open the visual studio.. so i opened that with sublime text
    Thank you
     
  2. Ali_Akbar_Montazeri

    Ali_Akbar_Montazeri

    Joined:
    Dec 6, 2014
    Posts:
    168
    this is the dialog box from visual studio
     
  3. rasmus-unity

    rasmus-unity

    Unity Technologies

    Joined:
    Aug 15, 2014
    Posts:
    1,164
    Hi,

    Which platform are you building for? Ads is only supported currently on iOS and Android, and you can use

    Code (CSharp):
    1. #if UNITY_ADS
    2. using UnityEngine.Advertisements;
    3. #endif
    4.  
    5. (...)
    6.  
    7. #if UNITY_ADS
    8. Advertisement.Show();
    9. #endif
    to make it compile on other platforms.

    /Rasmus
     
    og_yvy, cryptrax and MrPacoGP like this.
  4. Ali_Akbar_Montazeri

    Ali_Akbar_Montazeri

    Joined:
    Dec 6, 2014
    Posts:
    168
    Hi, thanks for the answer

    If i'm not mistaken, i have set it to android device. But it's already solved now and i can't exactly remember how was it solved :)
     
  5. Loomabox

    Loomabox

    Joined:
    Nov 4, 2015
    Posts:
    19
    I have the same issue with 5.5.0f3. I have set it to android, but get this compiler error. How did you manage to solve it?
     
  6. Loomabox

    Loomabox

    Joined:
    Nov 4, 2015
    Posts:
    19
    Simple solution that worked for me: Switch Unity Ads OFF, save the project, close Unity. Run Unity again, open the project, switch the Unity Ads back ON.
     
  7. MrPacoGP

    MrPacoGP

    Joined:
    Jul 18, 2013
    Posts:
    271
    UNITY_ADS is not available for Apple TvOS?
     
  8. anomanstudio

    anomanstudio

    Joined:
    Dec 4, 2016
    Posts:
    4
    Woho, nice troubleshooting.
     
    zyndata likes this.
  9. jjeon9

    jjeon9

    Joined:
    Mar 11, 2017
    Posts:
    1
    awesome, it works for me. thanks.
     
  10. Vasilkb

    Vasilkb

    Joined:
    Jun 4, 2015
    Posts:
    15
    this worked .. thanks!
     
  11. Janibasha

    Janibasha

    Joined:
    Mar 7, 2017
    Posts:
    6
    Solution:

    ==========

    A simple solution that worked for me:

    Add windows ==> services ==> create a link by selecting project name and etc. after login

    Switch Unity Ads OFF switch the Unity Ads back ON., save the project, close Unity. Run Unity again, open the project,
     
    Last edited: May 3, 2017
  12. Dj_Zuczyslaw

    Dj_Zuczyslaw

    Joined:
    Mar 20, 2014
    Posts:
    31
    Those solutions (from Janibasha and Loomabox) don't work for me :(

    This is strange - when I open my old project there is no errors. But when I copy this old project (to use as a template) , paste it, change name and link to new created project on unity www dashboards I have this error :(


    Edit: Ufff, now it's working :)
    I used information from those theards:

    https://forum.unity3d.com/threads/t...6720.15356817.1496177518-113052110.1489970827

    https://forum.unity3d.com/threads/how-to-troubleshoot-unity-5-5-integrations.443908/
    1. 1. Edit > Project Settings > Editor
      2. Asset Serialization > mode -> Force text
      3. In Finder, open either [Unity project] > ProjectSettings > `UnityAdsSettings.asset` OR `UnityConnectSettings.asset`
      4. Locate these properties, and enable them like so:

      UnityAdsSettings:
      m_Enabled: 1
      m_InitializeOnStartup: 1
    And for android on "m_EnabledPlatforms:" should be: 4294967295

    (m_EnabledPlatforms: 4294967295)
     
    Last edited: May 31, 2017
  13. Bui-Van-Nam

    Bui-Van-Nam

    Joined:
    Dec 10, 2013
    Posts:
    1
  14. The_Devil

    The_Devil

    Joined:
    Jun 6, 2015
    Posts:
    29
    I tried all of the above and it is still not working. I am on Unity 5.6.0f3.
     
  15. Stents

    Stents

    Joined:
    Jan 23, 2014
    Posts:
    8
    I'm also having this issue. Ads were working fine, then I unlinked the project and linked it to a new project, now Ads are not initializing on Android. Tried all the above suggestions... currently on 5.6.1p1.

    Should note that Analytics works fine with the new projectID, as does purchasing just not Ads, seems as though "Enable builtin Ads extension" is maybe not working for us?
     
  16. Guillaumzed

    Guillaumzed

    Joined:
    Mar 29, 2015
    Posts:
    68
    Not working for me neither. UNity 5.6.3
     
  17. lifeisfunxyz

    lifeisfunxyz

    Joined:
    Aug 9, 2017
    Posts:
    8
    download unity ads plugin from assets store and import to project.
    (worked with me)
     
  18. _Auron_

    _Auron_

    Joined:
    Sep 16, 2016
    Posts:
    4
    Using Unity 5.6.2 and I am getting Assets/Scripts/GameManager.cs(3,19): error CS0234: The type or namespace name `Advertisements' does not exist in the namespace `UnityEngine'. Are you missing an assembly reference?

    Ads is enabled as a service with a linked project ID, following the off/on steps mentioned in previous posts didn't do anything. Even deleted and regenerated the .sln file.

    Anyone still having this problem?
     
    zero_null likes this.
  19. Smougen00

    Smougen00

    Joined:
    Jan 5, 2017
    Posts:
    1
    Solution for 5.6
    close unity delete file /ProjectSettings/UnityConnectSettings.asset
    open unity turn ON ads and Boom
     
    zero_null likes this.
  20. thedarcsage

    thedarcsage

    Joined:
    Nov 2, 2016
    Posts:
    20
    Those solutions worked for me before.

    However, now that I'm on 2017.1.3p2, I tried the above solutions and they didn't work. It also could be because I rolled back to a previous version in my Collab History.

    So I searched and found another solution:

    https://stackoverflow.com/questions...ityengine-advertisements-library-inaccessible

    In short, re-importing Unity Ads from the Asset Store worked without doing anything else. I pressed Play, and the errors were gone.
     
  21. DarkT0mato

    DarkT0mato

    Joined:
    Feb 23, 2018
    Posts:
    14
    None of the Solutions worked for me...
    But finally, I found a solution that did work!

    Go to the Unity Asset store and Search "Unity Ads".
    Download the latest version of Unity ads by "Unity technologies".
    and the problem should be solved!
     
  22. hameed-ullah-jan

    hameed-ullah-jan

    Joined:
    Sep 24, 2014
    Posts:
    7
    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.
     
  23. DanilLetov

    DanilLetov

    Joined:
    Sep 28, 2017
    Posts:
    2
    Solution for 2018.2.10f1
    if the package is already imported

    Assets -> Reimport All
     
  24. ramuchilla

    ramuchilla

    Joined:
    Oct 4, 2017
    Posts:
    3
    how to switch of the unity ads ??
     
  25. tataygames

    tataygames

    Joined:
    Aug 4, 2016
    Posts:
    19
    I dont get it why unity devs dont test if this unityads ads will work on certain versions of unity.
    Im just starting my project and I cant even pass to this unity ads implementation, a simple advertisement that is cannot seen when compiled even you download and imported the latest unityads in assetstore.
    cant even start my project in unity 5.5.6
    tried all those help above and nothing works
     
  26. tataygames

    tataygames

    Joined:
    Aug 4, 2016
    Posts:
    19
    Is it possible to set this in default whenever you will create a new project at start, so you dont need to go to projectsettings and edit this before the unityads bug will disappear.


     
  27. stinkyboy

    stinkyboy

    Joined:
    May 15, 2018
    Posts:
    1

    Works!
     
Thread Status:
Not open for further replies.