Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

TypeLoadException Unity Ads v2.3.0 in Unity 5.4.4p1 iOS

Discussion in 'Unity Ads' started by breban1, Oct 3, 2018.

  1. breban1

    breban1

    Joined:
    Jun 7, 2016
    Posts:
    135
    It's been a while since I updated my Unity Ads (v2.0.x) Dec. 2017 (running Unity 5.4.4p1). After doing the update, everything works fine in the Editor and on Android, but throws an exception on iOS at initialization (new iPad, 5c, 6).

    Looks like it stems from UnityEngine.Advertisements.Purchasing.Initialize -> UnityEngine.Advertisements.iOS.Platform.UnityAdsPurchasingInitialize()

    Checks:
    isInitialized=true
    Version=2.3.0
    iSupported=true

    With the advent of Unity Ads Promo, is an update to Unity IAP required? I hope not, because I tried that and couldn't get that to compile to save my life.

    Anyone else have this issue? Unity team HELP!

    Screenshot attached.
     

    Attached Files:

  2. breban1

    breban1

    Joined:
    Jun 7, 2016
    Posts:
    135
    Hoping someone can answer from the Unity Team here. The Unity Asset Store Unity Ads 2.3.0 shows, "Package has been submitted using Unity 4.6.0, and 5.0.1 to improve compatibility with the range of these versions of Unity". I'm using 5.4.4p1 and I'm getting this TypeLoadException on iOS only at runtime (it built fine).

    If 2.3.0 isn't compatible with Unity 5.4.4p1, what is the "latest" Unity Ads version that I should be using, and how would I go about getting it? The git repo only has the .framework folder that I can see, not the other ads files.

    Thanks!
     
  3. DenisasK

    DenisasK

    Unity Technologies

    Joined:
    Oct 13, 2016
    Posts:
    89
    Hello @breban1 thank you for bringing it to us. Please, try to clear a Library folder (inside your project). Possibly, something is cached in a wrong state. If clearing a library folder will not help, you can try to download the newest 5.4 (5.4.6f3) version.
    Unity 5.4 should support Unity Ads/IAP, it looks like a bug on Editor side.
     
  4. breban1

    breban1

    Joined:
    Jun 7, 2016
    Posts:
    135
    Thanks for the reply. Deleted the Library folder and it reimported everything. Same runtime error.

    Going to try 5.4.6f3 next, although I have an established game so I'm a little bit hesitant on updgrading at this point.
     
  5. breban1

    breban1

    Joined:
    Jun 7, 2016
    Posts:
    135
    Upgraded to Unity 5.4.6f3, same runtime error.

    I'm going to build a simple test project to see if there is a conflict with something in my specific project. I'll update thread after doing that.

    Is there a thread that has older versions of Unity Ads like there is for Unity IAP?

    Also, should I upload my project? Just not sure how high priority an old version of Unity will be with new Unity Ads.
     
  6. breban1

    breban1

    Joined:
    Jun 7, 2016
    Posts:
    135
    I created a very simple test project with just a button to play an ad and I get the same TypeLoadException at some point after Initialization on iOS devices. Works fine in the editor and on Android.

    What's next @DenisasK
     
  7. breban1

    breban1

    Joined:
    Jun 7, 2016
    Posts:
    135
    @DenisasK I built the same simple test project in 2017.4.12f1 and get the same runtime error. Sent bug report hoping it can be looked into.
     
  8. Dunk86

    Dunk86

    Joined:
    May 10, 2015
    Posts:
    51
    I had this TypeLoadException during automatic ads initialisation on the iOS device only, and I fixed it with the below:

    1) Open your ProjectSettings/UnityConnectSettings.asset file in notepad
    2) Look for the UnityAdsSettings section
    3) Check for missing fields. I had m_IosGameId and m_AndroidGameId missing, so I copied the values from m_gameIDs->iPhonePlayer and AndroidPlayer respectively.
    4) Rebuild to your device and see that it initialises correctly

    I use the integrated unity-ads through the services menu, and my project has gone through a 2017.2 -> 2018.2 upgrade, so probably there's an issue with Unity's config not carrying over correctly to the new package version of the ads module.
    @breban1 it would be good to know your bug report number, and if this workaround helps you at all.
     
  9. breban1

    breban1

    Joined:
    Jun 7, 2016
    Posts:
    135
    Thanks for the reply @Dunk86!

    I don't have a "UnityAdsSettings" section in my file. I initialize ads through code (not through services), although ads are turned ON in the services menu. File below... I wonder if I have to set the game ids earlier or something? I have a case number, but not a bug report number, I've never really submitted something before so here is the case # in case it helps: 1089478

    %YAML 1.1
    %TAG !u! tag:unity3d.com,2011:
    --- !u!310 &1
    UnityConnectSettings:
    m_ObjectHideFlags: 0
    m_Enabled: 0
    m_TestMode: 0
    m_TestEventUrl:
    m_TestConfigUrl:
    CrashReportingSettings:
    m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes
    m_Enabled: 0
    UnityPurchasingSettings:
    m_Enabled: 1
    m_TestMode: 0
    UnityAnalyticsSettings:
    m_Enabled: 1
    m_InitializeOnStartup: 1
    m_TestMode: 0
    m_TestEventUrl:
    m_TestConfigUrl:
     
  10. Dunk86

    Dunk86

    Joined:
    May 10, 2015
    Posts:
    51
    Hmm, I can't see your bug because Unity thought it was smart to only show an issue as viewable by the public if it's been verified by a QA member (even if someone does a direct search on the ID)

    I think it's definitely odd that your UnityConnectSettings doesn't have a UnityAdsSettings section.
    For reference, mine looks like this:

    UnityAnalyticsSettings:
    m_Enabled: 1
    m_InitializeOnStartup: 1
    m_TestMode: 1
    m_TestEventUrl:
    m_TestConfigUrl:
    UnityAdsSettings:
    m_Enabled: 1
    m_InitializeOnStartup: 1
    m_TestMode: 0
    m_IosGameId: *****14
    m_AndroidGameId: *****13
    m_GameIds:
    AndroidPlayer: *****13
    iPhonePlayer: *****14
    m_GameId: *****13
    PerformanceReportingSettings:
    m_Enabled: 0

    I've starred out most of the digits of the game IDs, but you should be able to find your numbers from Unity's online dashboard https://developer.cloud.unity3d.com/
    If you're desperate, it might be worth even just pasting in that section to see if it helps (if you're doing initialisation through code, change the 'm_InitializeOnStartup' line to 0)
    but yeah... I don't know what else to suggest . :(
     
  11. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    7,118
    Is this affecting your game, or did you just notice it in the logs?
     
  12. breban1

    breban1

    Joined:
    Jun 7, 2016
    Posts:
    135
    @JeffDUnity3D

    Just noticed it in the logs. I believe this may be the same thing I'm seeing in my 2017.4.26f1 that you replied to in this other thread https://forum.unity.com/threads/ios-a-type-load-exception-has-occurred.666346/#post-4483333 so I think it should be fine.

    FIXED: I "unwatched" the thread, then "watched" again and it gave me the option to email. DISREGARD (Another question Jeff, I am watching the threads I have posted but I don't receive email notification, that is why I am replying to this so late. Do you know where the setting is to receive email notification when someone responds in a post?)
     
    Last edited: May 10, 2019
unityunity