Current version of the unityadsgodot-release.aar
is available for download under Releases
The new export templates for android was introduced in Godot 3.5.1
- In Godot open up the Android export template settings by going to
Project -> Export
.- Select
Android
and enable costom build. - Instal custom android build template.
- Select
- Download UnityAds Android library from here
- Open up the Godots projects
android
folder and create a folder calledplugins
if it isn't there. - Place the
unityadsgodot-release.aar
inside the freshly created plugins folder along withunity-ads.aar
andUnityAdsGodot.gdap
. - Last thing is to enable this plugin under
Project -> Export -> Android -> Plugins
and check the checkbox besidesUnity Ads Godot
Usage example is availible in AdsExampleProject
in this repository but basically the code below sums it up
var addsEngine = null
# Called when the node enters the scene tree for the first time.
func _ready():
if Engine.has_singleton("UnityAdsGodot"):
unityads = Engine.get_singleton("UnityAdsGodot")
unityads.connect("UnityAdsReady", self, "_on_UnityAdsReady")
unityads.connect("UnityAdsStart", self, "_on_UnityAdsStart")
unityads.connect("UnityAdsFinish", self, "_on_UnityAdsFinished")
unityads.connect("UnityAdsLoad", self, "_on_UnityAdsLoad")
unityads.connect("UnityAdsError", self, "_on_UnityAdsError")
unityads.connect("UnityAdsLoadError", self, "_on_UnityAdsLoadError")
addsEngine.initialise("1687685", false) # UNITY_ADS_PROJECT (from your Unity console) and TestMode enabled
else:
print("Couldn't find UnityAdsGodot plug-in")
func _on_UnityAdsReady():
print("UnityAdsReady is ready")
func _on_UnityAdsError(reason, message=""):
print("UnityAdsError. Reason: "+reason+", "+message)
func _on_UnityAdsLoad(id=""):
print("_on_UnityAdsLoad")
func _on_UnityAdsLoadError(reason, message=""):
print("UnityAdsLoadError. Reason: "+reason+", "+message)
unityads.loadAd("placementID")
func _on_RewardedVideo_pressed():
if unityads != null and unityads.unityads():
if !unityads.adIsLoaded():
unityads.loadAd("placementID")
while !unityads.adIsLoaded():
yield(get_tree().create_timer(0.5), "timeout")
unityads.show("placementID") #Take placementID from unity console
func _on_UnityAdsFinished(placement, reason):
reason = int(reason)
if reason == 2:
print("UnityAdsFinished good")
elif reason == 1:
print("UnityAdsFinished User skipped ad")
else:
print("UnityAdsFinished Something went wrong")
- Banners are not working?