Hi all,
I need to show 2 rewarded ads in my scenen.
One, give another chance if you loose.
Second give you double reward if you win.
But as far as I see if I use the same script (rewarded ads button script in documentation) for those 2 buttons it is kinda have a conflict and even game crashes.
How can I solve this problem, I saw Advertisement.RemoveListener (this) as answer in some forum answers but as far as I see it is not in the last version.
Hi,
I have the same problem, I made two scripts:
- one that doubles the playerâs reward,
- one that gives him a second life if he dies.
When I watch an ad to get a second life everything works fine but if I change the scene and want to watch the ad to get double points I get this error :
MissingReferenceException: The object of type âGameObjectâ 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.GameObject.GetComponent[T] () (at <07c89f7520694139991332d3cf930d48>:0)
SecondLife.OnUnityAdsShowComplete (System.String adUnitId, UnityEngine.Advertisements.UnityAdsShowCompletionState showCompletionState) (at Assets/Scripts/Game/SecondLife.cs:47)
UnityEngine.Advertisements.Platform.Editor.EditorPlatform+<>c__DisplayClass14_0.b__1 (System.Object sender, UnityEngine.Advertisements.Events.FinishEventArgs e) (at Library/PackageCache/com.unity.ads@4.0.0/Runtime/Advertisement/Platform/Editor/EditorPlatform.cs:156)
I realised that when I call a script, it calls all the others, as if they were all linked to each other, I also searched a few hours on forums and found the same solution: âAdvertisement.RemoveListerner(this)â, but it no longer exists.
If anyone has a solution Iâm interested
Please implement the âIUnityAdsShowListenerâ and Implement your logic in the âIUnityAdsShowListener.OnUnityAdsShowCompleteâ method.
I couldnât see the relevance of this subject with mine. I need to check the loading before showing it, not after showing it.
To check whether the ad is loaded, you can call the Load method to load an ad, and if the ad is loaded, IUnityAdsLoadListener.OnUnityAdsLoaded will be called.
btw I found the problem. When you do something related to Canvas after ads video, game crashes.
As far as I see, rewarded video wants to use the canvas which uses for showing the video.
If you somehow disable that canvas or show another canvas it doesnât like it and even crashes the game.
We didnât hear this behavior before, would you be able to provide a reproducible sample project so we can check it?