Giter VIP home page Giter VIP logo

lightvessel-org / godot-admob-editor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from poingstudios/godot-admob-plugin

0.0 0.0 1.0 6.59 MB

This repository is for Godot's Addons to integrate natively AdMob to your Game Project without much configurations, with a beautiful UI and directly inside Godot Editor!

Home Page: https://godotengine.org/asset-library/asset/933

License: MIT License

Python 0.84% GDScript 99.16%

godot-admob-editor's Introduction

Version Download Asset Library Android iOS License Stars

🦾Godot AdMob Plugin

This addon provides an easy and beautiful way to configure AdMob directly through the editor. Supports godot-admob-android and godot-admob-ios.

Plugin Usage

📦Installation

📥Godot Asset Library (recommended)

  1. Find the AdMob plugin by poing.studios
  2. Click Download and Install
  3. Enable in Project→Project Settings→Plugins.
  4. Download godot-admob-android and/or godot-admob-ios in Project→Tools→AdMob Download Manager→Android/iOS→LatestVersion.
  5. To know how to deploy, check the README.md of godot-admob-android and/or godot-admob-ios.
Manual install for custom versions.
  1. Pick a specific version from tags
  2. Download and extract as a .zip or .tar.gz
  3. Copy the extracted addons/admob folder into res://addons on your project
  4. Download godot-admob-android and/or godot-admob-ios in Project→Tools→AdMob Download Manager→Android/iOS→LatestVersion.
  5. To know how to deploy, check the README.md of godot-admob-android and/or godot-admob-ios.

🙋‍♂️How to use

After installation, all the methods will be available for use in any .gd script.

📋Examples

Initialize AdMob
func _ready() -> void:
	#just need to call once
	MobileAds.initialize()

🎏Banner Ads

Load (will automatically shows)
# button signal on scene
func _on_load_banner_pressed() -> void:
	var unit_id : String
	if OS.get_name() == "Android":
		unit_id = "ca-app-pub-3940256099942544/6300978111"
	elif OS.get_name() == "iOS":
		unit_id = "ca-app-pub-3940256099942544/2934735716"

	var ad_view := AdView.new(unit_id, AdSize.BANNER, AdPosition.Values.TOP)
	ad_view.load_ad(AdRequest.new())

📺Interstitial Ads

Load
var interstitial_ad : InterstitialAd
var interstitial_ad_load_callback := InterstitialAdLoadCallback.new()
func _ready():
	interstitial_ad_load_callback.on_ad_failed_to_load = on_interstitial_ad_failed_to_load
	interstitial_ad_load_callback.on_ad_loaded = on_interstitial_ad_loaded

# button signal on scene
func _on_load_interstitial_pressed() -> void:
	var unit_id : String
	if OS.get_name() == "Android":
		unit_id = "ca-app-pub-3940256099942544/1033173712"
	elif OS.get_name() == "iOS":
		unit_id = "ca-app-pub-3940256099942544/4411468910"

	InterstitialAdLoader.new().load(unit_id, AdRequest.new(), interstitial_ad_load_callback)

func on_interstitial_ad_failed_to_load(adError : LoadAdError) -> void:
	print(adError.message)

func on_interstitial_ad_loaded(interstitial_ad : InterstitialAd) -> void:
	self.interstitial_ad = interstitial_ad
Show
# button signal on scene
func _on_show_pressed():
	if interstitial_ad:
		interstitial_ad.show()

🎁Rewarded Ads

Load
var rewarded_ad : RewardedAd
var rewarded_ad_load_callback := RewardedAdLoadCallback.new()

func _ready():
	rewarded_ad_load_callback.on_ad_failed_to_load = on_rewarded_ad_failed_to_load
	rewarded_ad_load_callback.on_ad_loaded = on_rewarded_ad_loaded

# button signal on scene
func _on_load_interstitial_pressed() -> void:
	var unit_id : String
	if OS.get_name() == "Android":
		unit_id = "ca-app-pub-3940256099942544/5224354917"
	elif OS.get_name() == "iOS":
		unit_id = "ca-app-pub-3940256099942544/1712485313"

	RewardedAdLoader.new().load(unit_id, AdRequest.new(), rewarded_ad_load_callback)

func on_rewarded_ad_failed_to_load(adError : LoadAdError) -> void:
	print(adError.message)
	
func on_rewarded_ad_loaded(rewarded_ad : RewardedAd) -> void:
	self.rewarded_ad = rewarded_ad
Show
# button signal on scene
func _on_show_pressed():
	if rewarded_ad:
		rewarded_ad.show()

🎁📺Rewarded Interstitial Ads

Load
var rewarded_interstitial_ad : RewardedInterstitialAd
var rewarded_interstitial_ad_load_callback := RewardedInterstitialAdLoadCallback.new()

func _ready():
	rewarded_interstitial_ad_load_callback.on_ad_failed_to_load = on_rewarded_interstitial_ad_failed_to_load
	rewarded_interstitial_ad_load_callback.on_ad_loaded = on_rewarded_interstitial_ad_loaded

# button signal on scene
func _on_load_interstitial_pressed() -> void:
	var unit_id : String
	if OS.get_name() == "Android":
		unit_id = "ca-app-pub-3940256099942544/5354046379"
	elif OS.get_name() == "iOS":
		unit_id = "ca-app-pub-3940256099942544/6978759866"
	
	RewardedInterstitialAdLoader.new().load(unit_id, AdRequest.new(), rewarded_interstitial_ad_load_callback)

func on_rewarded_interstitial_ad_failed_to_load(adError : LoadAdError) -> void:
	print(adError.message)
	
func on_rewarded_interstitial_ad_loaded(rewarded_interstitial_ad : RewardedInterstitialAd) -> void:
	self.rewarded_interstitial_ad = rewarded_interstitial_ad
Show
# button signal on scene
func _on_show_pressed():
	if rewarded_interstitial_ad:
		rewarded_interstitial_ad.show(on_user_earned_reward_listener)

📎Useful links:

📄Documentation

For a complete documentation of this Plugin including how to mediation: check here.

Alternatively, you can check the docs of AdMob itself of Android and iOS.

🙏 Support

If you find our work valuable and would like to support us, consider contributing via these platforms:

Patreon

Ko-fi

Paypal

Your support helps us continue to improve and maintain this plugin. Thank you for being a part of our community!

🆘Getting help

DISCUSSIONS DISCORD

⭐ Star History

If you appreciate our work, don't forget to give us a star on GitHub! ⭐

Star History Chart

godot-admob-editor's People

Contributors

acb-prgm avatar gianlluca avatar gumaciel avatar kyoz avatar nathanfranke avatar

Forkers

ryosumin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.