D
D
d1msk1y2021-08-28 01:09:47
Unity
d1msk1y, 2021-08-28 01:09:47

How to display test ads in a unit?

At the final stage of game development, I added AdMob ads to the game. I did everything according to the tutorial. Everything works as it should in the editor, interstitial ads are displayed, ads with rewards too. I built the project into an apk file, threw it on the phone, and then it started. I click on the button to view rewarded ads, but ads are not shown, interstitial advertising should work after death , but it doesn’t exist either. But this is half the problem, when after losing I click on restart, the restart menu simply disappears and the game does not restart. In the game, when a player collides with an enemy, the player dies, but in the build he just touches him and that's it.
I say right away:
1. There are no problems in the editor.
2. The player does not die after a collision with only one type of enemy, although the principle of operation is the same for all.
3. Before adding the admob package, everything worked fine, but I checked before adding the ad itself and many more actions.


And here is the error in the console. The error is marked with an orange sign⚠️
You are trying to create a MonoBehaviour using the 'new' keyword. This is not allowed. MonoBehaviours can only be added using AddComponent(). Alternatively, your script can inherit from ScriptableObject or no base class at all
UnityEngine.MonoBehaviour:.ctor ()
ButtonBehaviour:.ctor ()
GoogleMobileAds.Unity.InterstitialClient:CreateButtonBehavior ()
GoogleMobileAds.Unity.InterstitialClient:Show ()
GoogleMobileAds.Api. InterstitialAd:Show()
InterAd:ShowAd () (at Assets/Scripts/Ads/InterAd.cs:23)
PlayerController:Die () (at Assets/Scripts/PlayerController.cs:128)
PlayerController:OnCollisionEnter2D (UnityEngine.Collision2D) (at Assets/Scripts/ PlayerController.cs:95)

I'm sure it's just this error, since OnCollisionEnter2D is mentioned there and the line in which, in theory, the player should die from touching the enemy.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2021-08-28
@d1msk1y

Well, yes, it should be corrected. All because of her. You cannot create a successor to a monobeh through New

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question