Unity and Android Studio Integration
To Set up an Android project for a Unity project is really simple.
File -> Build Settings -> Androidand click
Google Android Project
Exportand choose where you want the Android project to be
The Export will produce a structure similar to this:
- Import the project you have just created with Unity in the way you would use for Eclipse Projects.
- Done 🙂
This doesn’t mean that you can develop a Unity App Project in Android Studio. The development of the (mostly) game has to be done in Unity.
If you only want to make an APK from a Unity project you don’t need Android Studio in most cases. Just use the Build Settings from Unity and this time, disable Google Android Project. The button <Export> will change into <Build>. The click on <Build> will pack an Android APK that can be uploaded to your phone.
To export the Unity Source Code and import it into Android Studio could be interesting to add certain type of Ads or build Cardboard (Virtual Reality) Apps.
A good starting point for Android – Unity Developer is the Android Section in the Unity-Manual.
To force the Unity game into landscape mode, you have to make the configuration in Unity NOT in Android Studio.
This is what you do:
Open again the Build Settings Menu and click on Player Settings.
The Player Settings button opens the Inspector Window.
Go to Resolution and Presentation and choose one of the Landscape Modes (green arrows).
The configuration made here in Unity will then make the right entry in the AndroidManifest.xml, like this:
Now, go ahead and export the project from Unity like before and import it into Android Studio.
Here we go.
If you want to see how the Android Studio Project looks like for this example, download it from here.
A project like this is made in a day when you start from scratch. And you can be even faster by using one of the templates the Unity Asset Store offers.
Our New Game for Android
read more and win the full Source Code.