Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We've updated our Terms of Service. Please read our blog post from Unity CTO and Co-Founder Joachim Ante here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Crash on Android dismissing rewarded video Monetization 3.0 plugin

Discussion in 'Unity Ads' started by Antony-Blackett, Oct 30, 2018.

  1. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,165
    Screen Shot 2018-10-30 at 6.33.05 PM.png

    It seems there an error when releasing the ad or ad view or something like that.

    I've tried in Mono and Il2CPP same result.

    Works on iOS.
    Worked on Android with services ads plugin but not monetization 3.0
     
  2. DenisasK

    DenisasK

    Unity Technologies

    Joined:
    Oct 13, 2016
    Posts:
    51
  3. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,165
    I logged a bug with an attached project

    Case 1095893
     
  4. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,165
    Hi, the log looked like it was the ad crashing only on Android, but on further investigation it's actually something in the callback on ad close. I'm looking into it further, i'm unsure why it only happens on android and with the latest monetization plugin.

    I'll keep you posted. I also updated the bug case with this info.

    Cheers.
     
  5. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,165
    Update:

    It's strange. If I move the stuff in the callback to happen in update the frame later, no crash, everything is fine. But I can't figure out why the crash happens.
     
  6. Nowlz

    Nowlz

    Joined:
    Nov 18, 2016
    Posts:
    45
    I'm seeing similar behaviour with Unity Ads supplied via AdMob mediation. When you dismiss a Unity Ad my application crashes but only on Android. Planning on doing more investigation this evening.
     
  7. thibouf

    thibouf

    Joined:
    Mar 17, 2017
    Posts:
    57
    Same problem here ... Systematic crash when closing an ad on android (rewarded or interstitial) ... I am investigating in my side ...
     
  8. pikatch

    pikatch

    Joined:
    Sep 25, 2014
    Posts:
    1
    I'm having the same issue on my game, some phones crashes after watching an AD (interstitial). Do you confirm that Waiting the next frame corrects the issue ? Could be a simple workaround to make but I have no way to test it (can't reproduce the crash on my phones) ...
     
  9. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,069
  10. Nowlz

    Nowlz

    Joined:
    Nov 18, 2016
    Posts:
    45
    Here's what I'm seeing in the editor.log

    Code (CSharp):
    1. 0x00000001417BB06B (Unity) StackWalker::GetCurrentCallstack
    2. 0x00000001417BCD4F (Unity) StackWalker::ShowCallstack
    3. 0x0000000141796B60 (Unity) GetStacktrace
    4. 0x0000000140D4D25B (Unity) DebugStringToFile
    5. 0x0000000140D4DA3C (Unity) DebugStringToFile
    6. 0x0000000140E95113 (Unity) GeneralConnection::Connection::SendMessageA
    7. 0x0000000140E96239 (Unity) GeneralConnection::SendMessageA
    8. 0x000000014102F46E (Unity) ProfilerConnection::SetConnectedProfiler
    9. 0x0000000140E971BC (Unity) GeneralConnection::Disconnect
    10. 0x0000000140E9975C (Unity) GeneralConnection::Poll
    11. 0x0000000140E9BB1E (Unity) EditorConnection::PollWithCustomMessage
    12. 0x0000000141740482 (Unity) Application::TickTimer
    13. 0x000000014180C9CC (Unity) CrashCallback
    14. 0x000000014180E554 (Unity) WinMain
    15. 0x0000000141AF369C (Unity) strnlen
    16. 0x00007FF9EF533034 (KERNEL32) BaseThreadInitThunk
    17. 0x00007FF9F1721461 (ntdll) RtlUserThreadStart
     
  11. RossRothenstineU3D

    RossRothenstineU3D

    Unity Technologies

    Joined:
    Oct 26, 2018
    Posts:
    3
    Hello @Antony-Blackett ,

    Our initial investigation has found that it appears the callbacks aren't invoked on Unity's main thread on Android, but is doing so on iOS. It will be inconvenient, but for now you'll have to do the Unity GameObject manipulation on the next frame for Android.

    This will be fixed in our next patch release, and we will also be adding this as a test case for future releases. Thanks for reporting this!

    I also want to add that the
    startCallback
    is invoked on the UI thread, and calling it on the Main Thread can't be done because Unity is paused during Ad playback.

    RR
     
    Last edited: Oct 31, 2018
    pikatch likes this.
  12. Antony-Blackett

    Antony-Blackett

    Joined:
    Feb 15, 2011
    Posts:
    1,165

    Ah ok,

    Good to know that my workaround fix is indeed the correct fix for the moment. Thanks for the quick response.

    Cheers,
    Antony.
     
  13. Nowlz

    Nowlz

    Joined:
    Nov 18, 2016
    Posts:
    45
    Any hint as to when the next patch may be released?
     
  14. Simone82

    Simone82

    Joined:
    Jun 20, 2016
    Posts:
    1
    hi, the problem in unit 2018.3.0f2 is the same. on Android it causes crashes at the beginning of the level that runs the script. If I do a build without ads, everything works. Reading around hypothesize that the problem occurs when the function returns NULL:

    private IEnumerator ShowAdWhenReady()
    {
    while (!Monetization.IsReady(placementId))
    {

    yield return new WaitForSeconds(0.25f);

    }

    ShowAdPlacementContent ad = null;


    ad = Monetization.GetPlacementContent(placementId) as ShowAdPlacementContent;



    if (ad != null){
    ad.Show();

    }


    }
    any idea to bypass this problem?

    Ty!!
     
    gamearea3006 and spsarras like this.
  15. ap-unity

    ap-unity

    Unity Technologies

    Joined:
    Aug 3, 2016
    Posts:
    1,069