Skip to content

Latest commit

Β 

History

976 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Godot AdMob Plugin

VersionBadge GodotBadge StarsBadge DiscordBadge LicenseBadge
DownloadsBadge AssetStoreBadge
AndroidBadge iOSBadge GDScriptBadge CSharpBadge

The complete solution for Google AdMob integration in Godot using GDScript or C#.

Plugin Usage

🎬 Watch Video Tutorial β€’ πŸ“– Read Documentation


πŸ“¦ Installation β€’ 🎨 Ad Formats β€’ πŸ“‹ Examples β€’ πŸ™ Support


✨ Key Features

  • Google SDK Experience: Designed to mirror the official Google Mobile Ads SDK structure, APIs, and documentation.
  • Godot 4.2.0+: Native support for Android and iOS with full 1:1 GDScript and C# parity.
  • All Formats & Mediations: Out-of-the-box support for all Google ad formats and mediation adapters.
  • Editor Mock Ads: Test and preview ad layouts directly inside the Godot Editor.
  • AI-Agent Ready: Optimized to work with AI coding assistants for automated configuration.

πŸ“¦ Installation

πŸ“₯ Godot Asset Store (Recommended)

  1. Open your Godot project.
  2. Go to the AssetLib tab and search for AdMob by Poing Studios.
  3. Click Download and Install.
Manual Installation (Custom Releases)
  1. Download the latest poing-godot-admob-v*.zip from the Releases page.
  2. Extract the ZIP archive directly into your project's root folder (res://).

βš™οΈ Post-Installation Setup

  1. Enable the plugin in Project β†’ Project Settings β†’ Plugins.
  2. Configure the required native dependencies for your target platforms:

Tip

If automated package downloads fail, or when updating your Godot Engine version, trigger them manually in the editor via Project β†’ Tools β†’ AdMob Manager β†’ (Android/iOS) β†’ Download & Install.


🎨 Showcase

Banner Collapsible Banner Interstitial Native
Banner Ad Collapsible Banner Ad Interstitial Ad Native Small Ad
Native Video Rewarded UMP Consent Ad Inspector
Native Video Ad Rewarded Ad UMP Consent Ad Inspector

πŸ™‹β€β™‚οΈ How to Use

After installation, the MobileAds singleton becomes globally available in any script.

πŸ“‹ Examples

🏁 Initialize AdMob

Must be called once during game startup before requesting any ads.

GDScript
func _ready() -> void:
	MobileAds.initialize()
C#
using PoingStudios.AdMob.Api;

public override void _Ready()
{
	MobileAds.Initialize();
}

πŸ“± App Open Ads

Designed to be shown when users cold-start or return to your game.

GDScript
var app_open_ad : AppOpenAd
var app_open_ad_load_callback := AppOpenAdLoadCallback.new()

func _ready() -> void:
	app_open_ad_load_callback.on_ad_failed_to_load = func(ad_error: LoadAdError):
		print("Load failed: ", ad_error.message)
	app_open_ad_load_callback.on_ad_loaded = func(ad: AppOpenAd):
		app_open_ad = ad

func _on_load_app_open_pressed() -> void:
	var unit_id := "ca-app-pub-3940256099942544/9257395921" if OS.get_name() == "Android" else "ca-app-pub-3940256099942544/5575463023"
	AppOpenAdLoader.new().load(unit_id, AdRequest.new(), app_open_ad_load_callback)

func _on_show_pressed() -> void:
	if app_open_ad:
		app_open_ad.show()
C#
using Godot;
using PoingStudios.AdMob.Api;
using PoingStudios.AdMob.Api.Core;
using PoingStudios.AdMob.Api.Listeners;

private AppOpenAd _appOpenAd;

private void OnLoadAppOpenPressed()
{
	string unitId = OS.GetName() == "Android" ? "ca-app-pub-3940256099942544/9257395921" : "ca-app-pub-3940256099942544/5575463023";
	
	new AppOpenAdLoader().Load(unitId, new AdRequest(), new AppOpenAdLoadCallback
	{
		OnAdLoaded = ad => _appOpenAd = ad,
		OnAdFailedToLoad = err => GD.Print(err.Message)
	});
}

private void OnShowPressed()
{
	if (_appOpenAd != null)
	{
		_appOpenAd.Show();
	}
}

🎏 Banner Ads

Rectangular ads occupying a portion of the screen layout (supports standard and collapsible formats).

GDScript
var ad_view: AdView

func _on_load_banner_pressed() -> void:
	var unit_id := "ca-app-pub-3940256099942544/6300978111" if OS.get_name() == "Android" else "ca-app-pub-3940256099942544/2934735716"
	ad_view = AdView.new(unit_id, AdSize.BANNER, AdPosition.TOP)
	ad_view.load_ad(AdRequest.new())
C#
using Godot;
using PoingStudios.AdMob.Api;
using PoingStudios.AdMob.Api.Core;

private AdView _adView;

private void OnLoadBannerPressed()
{
	string unitId = OS.GetName() == "Android" ? "ca-app-pub-3940256099942544/6300978111" : "ca-app-pub-3940256099942544/2934735716";
	_adView = new AdView(unitId, AdSize.Banner, AdPosition.Top);
	_adView.LoadAd(new AdRequest());
}

πŸ“Ί Interstitial Ads

Full-screen ads covering the interface until dismissed by the user.

GDScript
var interstitial_ad : InterstitialAd
var load_callback := InterstitialAdLoadCallback.new()

func _ready() -> void:
	load_callback.on_ad_failed_to_load = func(error: LoadAdError):
		print("Load failed: ", error.message)
	load_callback.on_ad_loaded = func(ad: InterstitialAd):
		interstitial_ad = ad

func _on_load_interstitial_pressed() -> void:
	var unit_id := "ca-app-pub-3940256099942544/1033173712" if OS.get_name() == "Android" else "ca-app-pub-3940256099942544/4411468910"
	InterstitialAdLoader.new().load(unit_id, AdRequest.new(), load_callback)

func _on_show_pressed() -> void:
	if interstitial_ad:
		interstitial_ad.show()
C#
using Godot;
using PoingStudios.AdMob.Api;
using PoingStudios.AdMob.Api.Core;
using PoingStudios.AdMob.Api.Listeners;

private InterstitialAd _interstitialAd;

private void OnLoadInterstitialPressed()
{
	string unitId = OS.GetName() == "Android" ? "ca-app-pub-3940256099942544/1033173712" : "ca-app-pub-3940256099942544/4411468910";
	
	new InterstitialAdLoader().Load(unitId, new AdRequest(), new InterstitialAdLoadCallback
	{
		OnAdLoaded = ad => _interstitialAd = ad,
		OnAdFailedToLoad = err => GD.Print(err.Message)
	});
}

private void OnShowPressed()
{
	if (_interstitialAd != null)
	{
		_interstitialAd.Show();
	}
}

πŸ–ΌοΈ Native Overlay Ads

Highly customizable native layout format supporting small templates and native video playback.

GDScript
var native_overlay_ad: NativeOverlayAd

func _on_load_native_pressed() -> void:
	var unit_id := "ca-app-pub-3940256099942544/2247696110" if OS.get_name() == "Android" else "ca-app-pub-3940256099942544/3986624511"
	
	NativeOverlayAd.load(unit_id, AdRequest.new(), NativeAdOptions.new(), func(ad: NativeOverlayAd, error: LoadAdError):
		if error:
			print("Native ad failed to load: ", error.message)
			return
		native_overlay_ad = ad
		_render_native_ad()
	)

func _render_native_ad() -> void:
	var style := NativeTemplateStyle.new()
	style.template_id = NativeTemplateStyle.MEDIUM
	native_overlay_ad.render_template(style, AdPosition.BOTTOM)
C#
using Godot;
using PoingStudios.AdMob.Api;
using PoingStudios.AdMob.Api.Core;

private NativeOverlayAd _nativeOverlayAd;

private void OnLoadNativePressed()
{
	string unitId = OS.GetName() == "Android" ? "ca-app-pub-3940256099942544/2247696110" : "ca-app-pub-3940256099942544/3986624511";

	NativeOverlayAd.Load(unitId, new AdRequest(), new NativeAdOptions(), (ad, error) => {
		if (error != null)
		{
			GD.Print("Native ad failed to load: " + error.Message);
			return;
		}
		_nativeOverlayAd = ad;
		RenderNativeAd();
	});
}

private void RenderNativeAd()
{
	var style = new NativeTemplateStyle();
	style.TemplateId = NativeTemplateStyle.Medium;
	_nativeOverlayAd.RenderTemplate(style, AdPosition.Bottom);
}

🎁 Rewarded Ads

Allows you to give users in-game rewards for watching videos or interacting with ads.

GDScript
var rewarded_ad : RewardedAd
var load_callback := RewardedAdLoadCallback.new()

func _ready() -> void:
	load_callback.on_ad_failed_to_load = func(error: LoadAdError):
		print("Load failed: ", error.message)
	load_callback.on_ad_loaded = func(ad: RewardedAd):
		rewarded_ad = ad

func _on_load_rewarded_pressed() -> void:
	var unit_id := "ca-app-pub-3940256099942544/5224354917" if OS.get_name() == "Android" else "ca-app-pub-3940256099942544/1712485313"
	RewardedAdLoader.new().load(unit_id, AdRequest.new(), load_callback)

func _on_show_pressed() -> void:
	if rewarded_ad:
		rewarded_ad.show()
C#
using Godot;
using PoingStudios.AdMob.Api;
using PoingStudios.AdMob.Api.Core;
using PoingStudios.AdMob.Api.Listeners;

private RewardedAd _rewardedAd;

private void OnLoadRewardedPressed()
{
	string unitId = OS.GetName() == "Android" ? "ca-app-pub-3940256099942544/5224354917" : "ca-app-pub-3940256099942544/1712485313";

	new RewardedAdLoader().Load(unitId, new AdRequest(), new RewardedAdLoadCallback
	{
		OnAdLoaded = ad => _rewardedAd = ad,
		OnAdFailedToLoad = err => GD.Print(err.Message)
	});
}

private void OnShowPressed()
{
	if (_rewardedAd != null)
	{
		_rewardedAd.Show(new OnUserEarnedRewardListener
		{
			OnUserEarnedReward = reward => GD.Print($"Reward: {reward.Amount} {reward.Type}")
		});
	}
}

πŸŽπŸ“Ί Rewarded Interstitial Ads

Shows rewarded ads automatically during game transitions without requiring the user to opt-in.

GDScript
var rewarded_interstitial_ad : RewardedInterstitialAd
var load_callback := RewardedInterstitialAdLoadCallback.new()

func _ready() -> void:
	load_callback.on_ad_failed_to_load = func(error: LoadAdError):
		print("Load failed: ", error.message)
	load_callback.on_ad_loaded = func(ad: RewardedInterstitialAd):
		rewarded_interstitial_ad = ad

func _on_load_rewarded_interstitial_pressed() -> void:
	var unit_id := "ca-app-pub-3940256099942544/5354046379" if OS.get_name() == "Android" else "ca-app-pub-3940256099942544/6978759866"
	RewardedInterstitialAdLoader.new().load(unit_id, AdRequest.new(), load_callback)

func _on_show_pressed() -> void:
	if rewarded_interstitial_ad:
		rewarded_interstitial_ad.show(OnUserEarnedRewardListener.new(func(reward: RewardItem):
			print("User rewarded: ", reward.amount, " ", reward.type)
		))
C#
using Godot;
using PoingStudios.AdMob.Api;
using PoingStudios.AdMob.Api.Core;
using PoingStudios.AdMob.Api.Listeners;

private RewardedInterstitialAd _rewardedInterstitialAd;

private void OnLoadRewardedInterstitialPressed()
{
	string unitId = OS.GetName() == "Android" ? "ca-app-pub-3940256099942544/5354046379" : "ca-app-pub-3940256099942544/6978759866";
	
	new RewardedInterstitialAdLoader().Load(unitId, new AdRequest(), new RewardedInterstitialAdLoadCallback
	{
		OnAdLoaded = ad => _rewardedInterstitialAd = ad,
		OnAdFailedToLoad = err => GD.Print(err.Message)
	});
}

private void OnShowPressed()
{
	if (_rewardedInterstitialAd != null)
	{
		_rewardedInterstitialAd.Show(new OnUserEarnedRewardListener
		{
			OnUserEarnedReward = reward => GD.Print($"Reward: {reward.Amount} {reward.Type}")
		});
	}
}

πŸ”’ Privacy & Debugging Tools

🌐 User Messaging Platform (UMP)

Request user consent for personalized ads under regulations like GDPR, COPPA, and CCPA.

GDScript
func request_user_consent() -> void:
	var params := ConsentRequestParameters.new()
	ConsentInformation.request_consent_info_update(params, OnConsentInfoUpdateListener.new(
		func():
			if ConsentInformation.is_consent_form_available():
				ConsentForm.load_and_show_consent_form_if_required(OnConsentFormDismissedListener.new(
					func(error: FormError):
						if error:
							print("Consent form error: ", error.message)
				)),
		func(error: FormError):
			print("Consent info update error: ", error.message)
	))
C#
using PoingStudios.AdMob.Api.Ump;
using PoingStudios.AdMob.Api.Ump.Listeners;

public void RequestUserConsent()
{
	var params = new ConsentRequestParameters();
	UserMessagingPlatform.ConsentInformation.RequestConsentInfoUpdate(params, new OnConsentInfoUpdateListener
	{
		OnConsentInfoUpdateSuccess = () =>
		{
			if (UserMessagingPlatform.ConsentInformation.IsConsentFormAvailable())
			{
				UserMessagingPlatform.ConsentForm.LoadAndShowConsentFormIfRequired(new OnConsentFormDismissedListener
				{
					OnConsentFormDismissed = error =>
					{
						if (error != null)
						{
							GD.Print("Consent form error: " + error.Message);
						}
					}
				});
			}
		},
		OnConsentInfoUpdateFailure = error => GD.Print("Consent info update error: " + error.Message)
	});
}

πŸ” Ad Inspector

Google's diagnostic overlay to verify ad unit configurations, adapter statuses, and real-time ad delivery.

GDScript
func open_diagnostics() -> void:
	MobileAds.open_ad_inspector()
C#
using PoingStudios.AdMob.Api;

public void OpenDiagnostics()
{
	MobileAds.OpenAdInspector();
}

πŸ“Ž Useful Links

πŸ“„ Documentation

For complete documentation including third-party mediation networks setup: Official Documentation.

Alternatively, check AdMob's official SDK references for Android and iOS.

πŸ™ Support

If you find our work valuable and would like to support ongoing development, consider contributing:

PatreonBadge KofiBadge PaypalBadge

πŸ†˜ Getting Help

DiscussionsBadge DiscordHelpBadge


Star History

Star History Chart

About

Complete AdMob (Google Mobile Ads SDK) plugin for Godot. Supports GDScript and C#.

Topics

Resources

Contributing

Security policy

Stars

608 stars

Watchers

8 watching

Forks

Releases

Sponsor this project

Used by

Contributors

Languages