Initialization
Before loading or showing ads, it is strongly recommended to initialize AdMob. This prepares the Google Mobile Ads SDK, applies your App ID configuration, and initializes internal services and mediation adapters.
Initialization is required only once, typically at game startup or before requesting the first ad.
Although some ad requests may still work without explicitly calling initialization (due to lazy SDK startup), relying on this behavior is not recommended. Explicit initialization ensures more predictable behavior and future compatibility with Google Mobile Ads SDK updates.
Initialize Ad Mob
This function must be called before loading or showing any ads. Once triggered, the plugin starts the AdMob SDK and waits until the initialization is complete. This can sometimes take a little time (2 to 5 seconds).
When the SDK is ready, the On Completed callback is executed. You can pull from this pin and create a Custom Event to continue your logic, for example, to load a banner or an interstitial ad.
Parameter
On Completed
A delegate that is called after the AdMob SDK has finished initializing. No data is returned — it simply confirms that the system is ready to load and show ads.
Use this pin to trigger any ad loading logic.
Is Ad Mob Ready
This function returns whether the AdMob SDK has finished initializing. It is useful if you want to check the initialization state before attempting to load or show ads.
If the result is true, you can safely proceed with ad requests.
If it is false, you should wait until initialization completes.
Parameter
Return Value
A boolean value indicating whether AdMob is fully initialized.
- true — the SDK is ready to load and display ads
- false — initialization is still in progress or has not started
Example
In this example, AdMob is initialized when the widget is first created using Event Construct. This setup is used here purely as an example — in a real project, initialization is usually called once at the start of the game, such as in the Game Instance or Main Menu level, before any ads are loaded.
After initialization successfully completes, the On Completed event triggers the Load Banner node to request a banner ad.
This setup ensures that the SDK is ready before any ad loading happens. It’s a typical pattern for menu screens or early initialization sequences, where ads should appear immediately after the app starts.
C++ Usage
All Blueprint functions are also available for use in C++. You can initialize AdMob and check its state directly through static methods of UAdMobCPPLibrary.
InitializeAdMob
#include "AdMobCPPLibrary.h"
void UMyClass::InitAdMob()
{
FOnAdMobInitializedNative OnCompleted;
OnCompleted.BindLambda([]()
{
UE_LOG(LogTemp, Log, TEXT("AdMob initialized successfully."));
});
UAdMobCPPLibrary::InitializeAdMob(OnCompleted);
}
IsAdMobReady
#include "AdMobCPPLibrary.h"
void UMyClass::CheckAdMob()
{
bool bIsReady = UAdMobCPPLibrary::IsAdMobReady();
UE_LOG(LogTemp, Log, TEXT("Is AdMob ready? %s"),
bIsReady ? TEXT("Yes") : TEXT("No"));
}