Open ekingunoncu opened 5 years ago
I had the same problem. For some reason, it was being caused by the portrait/landscape.
@ekingunoncu I think you forget to call loadBanner(), loadInterstitial(), loadRewardedVideo after admob.init(isReal...) in func _init. Like this https://github.com/kloder-games/godot-admob/blob/master/examples/godot-3/main.gd#L14
This issue still persists? @ekingunoncu
Hello!
I build my game for android. My Godot version is 3.1. Firstly, thanks a lot for your efforts. I have an Issue. I don't know if I am doing something stupid but when I build the game I can see banner ads but not interstitial and rewarded ones.
I am using these Test Ids below: var adInterstitialId = "ca-app-pub-3940256099942544/1033173712" var adRewardedId = "ca-app-pub-3940256099942544/5224354917"
I made an object(node as gd script) named Admob `extends Node
var admob = null var isReal = false var isTop = true var adBannerId = "ca-app-pub-3940256099942544/6300978111" var adInterstitialId = "ca-app-pub-3940256099942544/1033173712" var adRewardedId = "ca-app-pub-3940256099942544/5224354917" var mainScene = load("res://scenes/MainScene.tscn")
func _init(): if(Engine.has_singleton("AdMob")): admob = Engine.get_singleton("AdMob") admob.init(isReal, get_instance_id())
func connectToResize(tree): tree.connect("screen_resized", self, "onResize")
func loadBanner(): if admob != null: admob.loadBanner(adBannerId, isTop)
func loadInterstitial(): if admob != null: admob.loadInterstitial(adInterstitialId)
func loadRewardedVideo(): if admob != null: admob.loadRewardedVideo(adRewardedId)
Events
func _on_BtnBanner_toggled(pressed): if admob != null: if pressed: admob.showBanner() else: admob.hideBanner()
func _on_BtnInterstitial_pressed(): if admob != null: admob.showInterstitial()
func _on_BtnRewardedVideo_pressed(): if admob != null: admob.showRewardedVideo()
func _on_admob_network_error(): print("Network Error")
func _on_admob_ad_loaded(): print("Ad loaded success") get_node("CanvasLayer/BtnBanner").set_disabled(false)
func _on_interstitial_not_loaded(): print("Error: Interstitial not loaded")
func _on_interstitial_loaded(): print("Interstitial loaded") get_node("CanvasLayer/BtnInterstitial").set_disabled(false)
func _on_interstitial_close(): print("Interstitial closed") get_node("CanvasLayer/BtnInterstitial").set_disabled(true)
func _on_rewarded_video_ad_loaded(): print("Rewarded loaded success") get_node("CanvasLayer/BtnRewardedVideo").set_disabled(false)
func _on_rewarded_video_ad_closed(): print("Rewarded closed") get_node("CanvasLayer/BtnRewardedVideo").set_disabled(true) loadRewardedVideo()
func _on_rewarded(currency, amount): print("Reward: " + currency + ", " + str(amount)) get_node("CanvasLayer/LblRewarded").set_text("Reward: " + currency + ", " + str(amount))
Resize
func onResize(): if admob != null: admob.resize() `
When I initialize Admob object and call the methods in my opening scene for Banner everything works fine but with the same logic other ads doesn't working.
works: admob.connectToResize(get_tree()) admob.loadBanner()
not working: admob.connectToResize(get_tree()) admob.loadInterstitial()
admob.connectToResize(get_tree()) admob.loadRewardedVideo()