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

game crashes when running ads reward callback

Discussion in 'Unity Ads' started by yaseersanni, Dec 18, 2019.

  1. yaseersanni


    Jul 23, 2017
    my game crashes each time i run google mobile ads on my unity game. it doesn't crash when i try watching the ad but it closes when i'm firing the reward call back for google mobile ads. help
    i have attached a file containing the log of the behavior of the app when i run the ads and the code snippets of my ads implementation. if there is any suggestion on what could possibly help please do post or if there's some kind of setting in unity i should turn on or off in unity before building please post. i really need any kind of help i can get. Thanks

    Attached Files:

  2. ap-unity


    Unity Technologies

    Aug 3, 2016

    This support forum is typically for the Unity Ads network, so I don't have much expertise on Google Mobile Ads issues.

    Taking a look at the files you provided, the log doesn't contain much, but a full device log might show more information.

    In the HandleRewardBasedVideoRewarded method, you are referencing a GM variable. I assume this is a game manager singleton / static reference. Does the crash only happen when you modify the variable?

    If so, then the rewarded callback might be happening on a different thread, so that might cause a crash. You could test this by getting the Thread ID (Thread.CurrentThread.ManagedThreadId).

    If that doesn't help, I would recommend reaching out to their support team.