- Home /
Unity Ads problem
I think I have checked every question concerning the subject, but I don't seem to find a similar one. I have a feeling that it must something simple I might have overlooked. The problem that I had unity ads set up very nicely - everything was working fine - but with the update of the Unity Ads SDK I was forced to change a few things. And now I have problems.
The problem is that when I click a certain button for a rewarded video, the testmode ad shows that everytinh is ok, but I can see in my console output that I have been rewarded not only for this ad, but also another one (from another scene)
What I have done so far:
I made a script for the initializing of the sdk just as shown in the guides
I have 3 placements (FreeGems, CoinDoubler, ResetTimer). 2 of them in the same scene (the main), and the CoinDoubler in another scene. When I test the game and press the button which triggers the CoinDoubler rewarded video, and eventually press "close" (to close the test ad) I get the Debug.Log lines: AdFinished: Player was rewarded 3 gems AdFinished: Player was rewarded double coins
And sometimes (I havn't found a steady pattern yet) it also shows this error:
MissingReferenceException: The object of type 'GameOver' has been destroyed but you are still trying to access it. Your script should either check if it is null or you should not destroy the object. UnityEngine.MonoBehaviour.StartCoroutine (System.Collections.IEnumerator routine) (at :0) GameOver.OnUnityAdsDidFinish (System.String myPlacementId, UnityEngine.Advertisements.ShowResult result) (at Assets/Scripts/Ingame/LevelManagers/GameOver.cs:284) UnityEngine.Advertisements.Platform.Platform+<>c_DisplayClass41_0.b_0 () (at Library/PackageCache/com.unity.ads@3.4.5/Runtime/Advertisement/Platform/Platform.cs:171) UnityEngine.Advertisements.Utilities.CoroutineExecutor.Update () (at Library/PackageCache/com.unity.ads@3.4.5/Runtime/Advertisement/Utilities/CoroutineExecutor.cs:17)
The GameOver script is the script where the ShowAd is called...
So...Each of the pieces of code that correspond to these ads are in totally differnent classes/scripts. If any piece of this code is needed to clarify the situation please tell me to attach it by editing this question.
Answer by Naxionman1978 · Jul 05, 2020 at 01:28 PM
How stupid of me...I hadn't included OnDestroy in my code...
Your answer
Follow this Question
Related Questions
Unity Ads: Non-fullscreen ads? 1 Answer
Delete a project from unity services? 2 Answers
Unity Ads not working on my Android device but works on many other devices 1 Answer
unity unable to convert to dex format, need help fast. 0 Answers
Applovin error - MissingReferenceException: No parent activity specified 0 Answers