All methods from this course are from Java and Android Studio, more advanced users can use Kotlin but Unity3D is C# and we cannot add methods directly in Unity3D. We need to export our application to Android Studio – Gradle project. It’s even recommended because in Android Studio we can use API 28, Unity3D still not support newest API. Let’s start them.
NOTES: get rid of Google Play Services plugins in Unity3D and import it in gradle. I not done it, so I had to remove some errors.
STEP 1 – OPEN YOUR UNITY3D PROJECT, WE HAVE SOME CANDY PIANO TILES (you can find it on our Discord)
Export project to Android Studio: Gradle + project, this cannot work with internal build!
STEP 2 – OPEN IN ANDROID STUDIO AND FIX ERRORS!
Accept gradle settings configuration!
Fix all implementation errors in gradle files! Compilation word needs to be implementation word! Like on screenshots. Also remove lines with minimum SDK from AndroidManifest.xml
Do not forget to add:
jcenter() to your all projects like on screenshot
minimum SDK to defaultConfig, Android will warn you if you try without it 😉
Unity3d cannot open our blackhat code (from other methods). We need to create some bypass activity, create new activity and name it Splash! It will be invisible!
Android Studio will extends your activity with ActivityAppCompat, change it to Activity because Unity3d will not work with AppCompat. Like on screenshoot.
Add new Intent code to open your Unity3D activity, ass soon as Splash opens! As you see on screenshot. We can add below our blackhat code, for example trigger to run outside app ads!
After our trigger, we can close splash activity!
Now, we need to change what activity starts first. In default, it’s Unity3D activity but we need splash screen first. Copy intent filter code from Unity3D activity, delete it and paste to your splash activity like on screenshots. Make it also invisible. Done, you can add blackhat methods to our Unity3D game 😉