Unresponsive screen while loading Admob interstitial.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Maz90

Hello.

I’m building my first game with Godot and i implemented Admo Ads using Shin Nil’s plugin.
the banners load without affecting the game’s performance, but when i load an interstitial the game becomes unresponsive to touch for brief moments which causes the player to fall and die (i’m autoloading the Admob script in game settings and loading the interstitial in the main scene).

Another problem is adaptive banners show at the very bottom of the screen where phone virtual buttons are, or at the very top where the notch and status bar not at the top or bottom of the actual game window as set in Godot which is smaller the one on the phone.

How can i pause code execution before showing the interstitial and resuming after a closed event?

Lastly. can i install the User Messaging sdk to show the GDPR consent dialog without a plugin by just following the official guide?

Thank you for your time and help.

Godot 3.5.1
Shin-Nil Admob Plugin 6.1.1
(Anything else you need to know just ask)

:bust_in_silhouette: Reply From: Juxxec

but when i load an interstitial the game becomes unresponsive to touch
for brief moments which causes the player to fall and die (i’m
autoloading the Admob script in game settings and loading the
interstitial in the main scene).

Can’t you just pause the game while the interstitial is loading? Just use set_process, set_process_input, etc. to stop execution. Or better yet, save your Node tree to a Branch Scene and in _ready():

# Load AdMod adds, interstitial, whatever
$AdMob.load_interstitial()
yield($AdMob, "interstitial_loaded")
$AdMob.load_rewarded_video()
yield($AdMob, "rewarded_video_loaded")
$AdMob.load_rewarded_interstitial()
yield($AdMob, "rewarded_interstitial_loaded")

# Your Scene with the Player Node and your other nodes
var game = load("res://scenes/Game.tscn")
add_child(game)

remove_child($LoadingLayer)

In the end, your scene will look something like this:

Main Scene

Another problem is adaptive banners show at the very bottom of the screen where phone virtual buttons are, or at the very top where the notch and status bar not at the top or bottom of the actual game window as set in Godot which is smaller the one on the phone.

Looking at the plugin documentation, the AdMob node has a property

# If true, displays banner on the top of the screen, if false displays on the bottom
# type bool, default true
banner_on_top

I assume that enabling it will move the banner out of the way.

How can i pause code execution before showing the interstitial and resuming after a closed event?

You can pause the code execution by using the following code:

$AdMob.show_interstitial()
# This will wait for the interstitial to close
yield($AdMob, "interstitial_closed")

You could call this method when your game is loading to avoid the lag.

Lastly. can i install the User Messaging sdk to show the GDPR consent dialog without a plugin by just following the official guide?

I am not familiar with this SDK, nor the official guide. Can you share more information about this? Regardless, you can use any library you wish, when you are using the Custom Build option in the export template.

Thanks a lot man. appreciate the info. i will try that out and tell you if it goes well.
I’m new to Godot and game dev in general, but i know the basics of programming.

Concerning the banners showing on top or bottom of screen, it’s not a problem of settings, if i set a banner to be shown on bottom, it’s shown on the bottom relative to phone screen, not game window. same with setting it to show on top, because after scaling and keeping aspect the actual game area is smaller than the phone screen.

About asking player for consent to be shown personalized ads, the official article says:

Under the Google EU User Consent Policy, you must make certain disclosures to your users in the European Economic Area (EEA) along with the UK and obtain their consent to use cookies or other local storage, where legally required, and to use personal data (such as AdID) to serve ads. This policy reflects the requirements of the EU ePrivacy Directive and the General Data Protection Regulation (GDPR).

Here’s the link to it

One more question. How can i add a die animation in place of character animation (which is an AnimationPlayer with frames) when latter dies?

Thanks again.
Peace.

Maz90 | 2022-12-03 21:39