Skip to content

Commit b57aa5b

Browse files
committed
Initial commit
0 parents  commit b57aa5b

File tree

22 files changed

+968
-0
lines changed

22 files changed

+968
-0
lines changed

.gitignore

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx
15+
16+
# Built application files
17+
*.apk
18+
*.aar
19+
*.ap_
20+
*.aab
21+
22+
# Files for the ART/Dalvik VM
23+
*.dex
24+
25+
# Java class files
26+
*.class
27+
28+
# Generated files
29+
bin/
30+
gen/
31+
out/
32+
# Uncomment the following line in case you need and you don't have the release build type files in your app
33+
# release/
34+
35+
# Gradle files
36+
.gradle/
37+
build/
38+
39+
# Local configuration file (sdk path, etc)
40+
local.properties
41+
42+
# Proguard folder generated by Eclipse
43+
proguard/
44+
45+
# Log Files
46+
*.log
47+
48+
# Android Studio Navigation editor temp files
49+
.navigation/
50+
51+
# Android Studio captures folder
52+
captures/
53+
54+
# IntelliJ
55+
*.iml
56+
.idea/workspace.xml
57+
.idea/tasks.xml
58+
.idea/gradle.xml
59+
.idea/assetWizardSettings.xml
60+
.idea/dictionaries
61+
.idea/libraries
62+
# Android Studio 3 in .gitignore file.
63+
.idea/caches
64+
.idea/modules.xml
65+
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
66+
.idea/navEditor.xml
67+
68+
# Keystore files
69+
# Uncomment the following lines if you do not want to check your keystore files in.
70+
*.jks
71+
*.keystore
72+
73+
# External native build folder generated in Android Studio 2.2 and later
74+
.externalNativeBuild
75+
.cxx/
76+
77+
# Google Services (e.g. APIs or Firebase)
78+
google-services.json
79+
80+
# Freeline
81+
freeline.py
82+
freeline/
83+
freeline_project_description.json
84+
85+
# fastlane
86+
fastlane/report.xml
87+
fastlane/Preview.html
88+
fastlane/screenshots
89+
fastlane/test_output
90+
fastlane/readme.md
91+
92+
# Version control
93+
vcs.xml
94+
95+
# lint
96+
lint/intermediates/
97+
lint/generated/
98+
lint/outputs/
99+
lint/tmp/
100+
lint/reports/

.idea/codeStyles/Project.xml

Lines changed: 116 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Unity ads for gotod using new export template system
2+
3+
## Requirements
4+
5+
The new export templates for android was introduced in godot 3.2.1, but we cannot link custom plugins as export settings panel is missing "Plugins" field so the minimum version would be 3.2.2 for this to run.
6+
7+
## Setup
8+
9+
- Open up the Android export template settings by going to `Project -> Export`.
10+
- Select `Android` and enable costom build.
11+
- In plugins feald type in `UnityAdsGodot`.
12+
- Open up the Godots projects `android` folder and create a folder called `plugins`.
13+
- Place the `UnityAdsGodot.aar` inside the freshly created plugins folder.
14+
- Download UnityAds Android library from [here](https://github.com/Unity-Technologies/unity-ads-android/releases)
15+
- Place the downloaded `unity-ads.aar` inside `android/build/libs/plugins`
16+
- Check if `android/build/build.gradle` does not have any filters for specific plugins and if theres a filter update the line as folows
17+
18+
```
19+
// Godot prebuilt plugins
20+
implementation fileTree(dir: 'libs/plugins', include: ["*.aar"])
21+
```
22+
23+
## Usage
24+
25+
```
26+
var adsEngine = null
27+
28+
# Called when the node enters the scene tree for the first time.
29+
func _ready():
30+
if Engine.has_singleton("UnityAdsGodot"):
31+
adsEngine = Engine.get_singleton("UnityAdsGodot")
32+
adsEngine.connect("UnityAdsReady", self, "_on_adsReady") # register callback for UnityAdsReady
33+
adsEngine.connect("UnityAdsFinish", self, "_on_adsFinished") # Register callback when video add is finished
34+
adsEngine.connect("UnityAdsError", self, "_on_adsError") # register error callback
35+
adsEngine.initialise("1687685", false) # App/Project id, Debug mode enabled - override
36+
else:
37+
print("Couldn't find HelloSignals singleton")
38+
39+
func _on_adsReady():
40+
print("This should be ready.")
41+
42+
# Video playback finished
43+
# 2 - UnityAds.FinishState.COMPLETED
44+
# 1 - UnityAds.FinishState.SKIPPED
45+
# 0 - UnityAds.FinishState.ERROR
46+
func _on_adsFinished(reason):
47+
print(reason)
48+
49+
# Called when unity ads engine has somekind of error with string as param.
50+
func _on_adsError(reason):
51+
print(reason)
52+
53+
func _on_showad_pressed():
54+
if addsEngine != null:
55+
if !adsEngine.isReady("rewardedVideo"):
56+
adsEngine.loadAd("rewardedVideo")
57+
else:
58+
adsEngine.show("rewardedVideo")
59+
```
60+
61+
## Compiling from source
62+
63+
TODO: Describe how to do this.
64+
65+
## TODOs
66+
67+
- [ ] Improve documentation
68+
- [ ] Code/Project cleanup
69+
- [ ] Banner ads are not working and seems that api is deprecated. Need to investigate that
70+
- [ ] Improve setup (possibly create a script for that)
71+
- [ ] Update error code reporting to GDScript
72+
73+
## Known issues
74+
75+
- Placement id always needs to be present for some reason
76+
- Banners are not working.

build.gradle

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2+
3+
buildscript {
4+
5+
repositories {
6+
google()
7+
jcenter()
8+
9+
}
10+
dependencies {
11+
classpath 'com.android.tools.build:gradle:3.6.1'
12+
13+
14+
// NOTE: Do not place your application dependencies here; they belong
15+
// in the individual module build.gradle files
16+
}
17+
}
18+
19+
allprojects {
20+
repositories {
21+
google()
22+
jcenter()
23+
24+
}
25+
}
26+
27+
task clean(type: Delete) {
28+
delete rootProject.buildDir
29+
}

godot-lib.release/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
configurations.maybeCreate("default")
2+
artifacts.add("default", file('godot-lib.release.aar'))

gradle.properties

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Project-wide Gradle settings.
2+
# IDE (e.g. Android Studio) users:
3+
# Gradle settings configured through the IDE *will override*
4+
# any settings specified in this file.
5+
# For more details on how to configure your build environment visit
6+
# http://www.gradle.org/docs/current/userguide/build_environment.html
7+
# Specifies the JVM arguments used for the daemon process.
8+
# The setting is particularly useful for tweaking memory settings.
9+
org.gradle.jvmargs=-Xmx1536m
10+
# When configured, Gradle will run in incubating parallel mode.
11+
# This option should only be used with decoupled projects. More details, visit
12+
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13+
# org.gradle.parallel=true
14+
# AndroidX package structure to make it clearer which packages are bundled with the
15+
# Android operating system, and which are packaged with your app's APK
16+
# https://developer.android.com/topic/libraries/support-library/androidx-rn
17+
android.useAndroidX=true
18+
# Automatically convert third-party libraries to use AndroidX
19+
android.enableJetifier=true
20+

gradle/wrapper/gradle-wrapper.jar

53.1 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Mon Apr 20 16:35:20 EEST 2020
2+
distributionBase=GRADLE_USER_HOME
3+
distributionPath=wrapper/dists
4+
zipStoreBase=GRADLE_USER_HOME
5+
zipStorePath=wrapper/dists
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip

0 commit comments

Comments
 (0)