Shin-NiL / Godot-Android-Admob-Plugin

Android AdMob plugin for Godot Game Engine 3.2 or higher
MIT License
543 stars 66 forks source link

admob signals not emitting #190

Closed DanesZalor closed 2 years ago

DanesZalor commented 2 years ago

Godot 3.4.3 Mono

AdMob Plugin version: 5.1.0

Admob signals are not emitting:

My code

image

the show_rewarded_video() works as the test ad plays, and logcat shows Admob: onRewardedVideoAdClosed but it doesnt call my connected function, or even print this: image from admob.cs

adb logcat

image

DanesZalor commented 2 years ago

Ah nevermind, the admob.cs I was using didn't appear to connect the signals so i edited the .cs file

by adding this function

public void connect_signals(){
    _admob_singleton.Connect("on_admob_ad_loaded", this, "_on_admob_ad_loaded");
    _admob_singleton.Connect("on_admob_banner_failed_to_load", this, "_on_admob_banner_failed_to_load");
    _admob_singleton.Connect("on_interstitial_failed_to_load", this, "_on_interstitial_failed_to_load");
    _admob_singleton.Connect("on_interstitial_loaded", this, "_on_interstitial_loaded");
    _admob_singleton.Connect("on_interstitial_close", this, "_on_interstitial_close");
    _admob_singleton.Connect("on_rewarded_video_ad_loaded", this, "_on_rewarded_video_ad_loaded");
    _admob_singleton.Connect("on_rewarded_video_ad_closed", this, "_on_rewarded_video_ad_closed");
    _admob_singleton.Connect("on_rewarded", this, "_on_rewarded");
    _admob_singleton.Connect("on_rewarded_video_ad_left_application", this, "_on_rewarded_video_ad_left_application");
    _admob_singleton.Connect("on_rewarded_video_ad_failed_to_load", this, "_on_rewarded_video_ad_failed_to_load");
    _admob_singleton.Connect("on_rewarded_video_ad_opened", this, "_on_rewarded_video_ad_opened");
    _admob_singleton.Connect("on_rewarded_video_started", this, "_on_rewarded_video_started");
}

and calling it on init()

private bool init()
    {
        if (Engine.HasSingleton("GodotAdMob"))
        {
            GD.Print("GetInstanceId() ", GetInstanceId());
            _admob_singleton = Engine.GetSingleton("GodotAdMob");
            _admob_singleton.Call(
                "initWithContentRating",
                is_real,
                GetInstanceId(),
                child_directed,
                is_personalized,
                max_ad_content_rate
                );

            connect_signals();
            return true;
        }
        return false;
    }