Scenes and banners problem.

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

In the script of MENU scene of my game i have the following code:

extends Control

onready var m=get_parent().get_node("Menu") 

var admob = null
var real_ads = false
var banner_top = false
var ad_banner_id = "ca-app-pub-3940256099942544/6300978111"
var enable_ads = true

func _ready():
	if Engine.has_singleton("AdMob"):
		admob = Engine.get_singleton("AdMob")
		admob.init(real_ads, get_instance_id())
		admob.loadBanner(ad_banner_id, banner_top)
        
func show_ad_banner():
	if admob and enable_ads:
		admob.showBanner()

func hide_ad_banner():
	if admob:
		admob.hideBanner()

func _on_NG_pressed():
	m.hide_ad_banner()
	k=get_tree().change_scene("res://Scenes/World.tscn")
	sscore.score=0
	pass 

So , when i start my game i see a banner on Menu scene and when i press the NG (New Game) button the banner is disappeared. So far all ok.

When i press the NG button the game starts with the gameplay scene (World). In the World scene i have a pause button and when i press it then opens a Pause scene.In the World tree i have as a child and the PauseScene with the following code:

extends Control

onready var l=get_parent().get_node("PauseScene") 

var admob2 = null
var real_ads2 = false
var banner_top2 = false
var ad_banner_id2 = "ca-app-pub-3940256099942544/6300978111"
var enable_ads2 = true

func _ready():
	if Engine.has_singleton("AdMob"):
		admob2 = Engine.get_singleton("AdMob")
		admob2.init(real_ads2, get_instance_id())
		admob2.loadBanner(ad_banner_id2, banner_top2)
        
func show_ad_banner2():
	if admob2 and enable_ads2:
		admob2.showBanner()

func hide_ad_banner2():
	if admob2:
		admob2.hideBanner()

func _on_Quit_pressed():
	get_tree().quit()
	pass 

func _on_Resume_pressed():
	l.hide_ad_banner2()
	get_tree().paused=not get_tree().paused
	visible= not visible
	pass

func _on_Again_pressed():
	l.hide_ad_banner2()

The problem is the following:

When the game starts, the banner after a while shows up again during the gameplay and disappears when i press only the resume button of Pause scene.
Also, while i want when someoene press the PauseButton to appear a banner, the banner doesnt appears.Instead, the banner appearing when i press the Again button
and disappears when i press the resume button of Pause scene.

Any idea please?
Thank you.

:bust_in_silhouette: Reply From: Devrex

you need to set admob pause mode to process