Search Unity

import Unity Ads error

Discussion in 'Unity Ads & User Acquisition' started by boolfone, Oct 12, 2014.

  1. boolfone

    boolfone

    Joined:
    Oct 2, 2014
    Posts:
    289
    I tried importing Unity Ads into my project, and I received the following error:

    Assets/UnityAds/Advertisements/PictureAds/PictureAdsRequestsManager.cs(81,56): error CS0117: `System.IO.File' does not contain a definition for `WriteAllBytes'

    Any ideas how to fix this?

    Thanks.

    importing-unity-ads-error.png
     
  2. Salazar

    Salazar

    Joined:
    Sep 2, 2013
    Posts:
    235
    Did you check this answer on unity answers? Maybe it helps.
     
  3. boolfone

    boolfone

    Joined:
    Oct 2, 2014
    Posts:
    289
    Thanks. I think that helped a bit.

    I was able to get around this issue by going to:

    File -> Build Settings...

    Then, I selected PC, Mac, and Linux Standalone and clicked "Switch Platform".

    The platform was set to "Web Player" initially.

    I'm not really 100% sure why that works or what "Switch Platform" really does though.
     
  4. ippdev

    ippdev

    Joined:
    Feb 7, 2010
    Posts:
    3,853
    Webplayer does not allow plugins with System.IO?
     
    unity-nikkolai likes this.
  5. unity-nikkolai

    unity-nikkolai

    Joined:
    Sep 18, 2014
    Posts:
    540
    Your code is compiled in editor based on the platform selected in Build Settings (indicated by the Unity logo next to the platform name). To change between platforms, select a target platform and then select Switch Platform. Whenever you return to the Unity editor after making changes to a script, your code will be recompiled based on this selected platform.

    When implementing Unity Ads, it's best to select either Android or iOS being that these are the two currently supported platforms. Selecting an appropriate platform also makes it easier to read regions of code with compiler directives for Platform Dependent Compilation.
     
  6. Stream

    Stream

    Joined:
    Oct 28, 2013
    Posts:
    37
    Do you fix this bug?
     
  7. unity-nikkolai

    unity-nikkolai

    Joined:
    Sep 18, 2014
    Posts:
    540
    Not yet. Still slated for the next update.