Nov 03, 2018 how to download and install unity 3d full version. U nity game engine is the most popular game development software available in the game development market. Unity game maker offer’s you to build unity 3d games, unity 2d games, multiplayer online games, ar games, VR games, and MR.
This project covers the process of integrating a game made with Unity within a native Android Application.
Objective
Integrate a Unity Game within an Android App, and establish a way for Communication / Data Transfer between the two, i.e.,
Unity For Android
- From the Android App, Start the game and Send an initial score to Unity.
- Receive the score in Unity. Play the game and increment the score. Send the final score back to Android.
- Back in Android, Get the score from Unity and finally display it.
Getting Started
Unity 3d Free Download For Android
Unity
I have made a simple game using Unity, in which the score increments on clicking the TAP button. On clicking the Finish button, the game ends. Then I exported the project using Gradle.
Android Studio
I then opened this project using Android Studio (Import Gradle Project). You can either convert this project into an Android Archive Library (AAR) and import it in your own Android Studio project or you can modify this project itself. I chose the latter option for this project. Unity creates the UnityPlayerActivity, containing the UnityPlayer, in Android. This class is used for all communications with Unity. I added more Activities to the Project, to execute the complete flow.
For more info:Detailed Guide to Embed Unity into Android
Free Download Unity 3d Full Version For Android
Communication / Data Transfer
1. Android (Java) -> Unity (C#)
In Android, start the UnityPlayerActivity from your Activity with an Intent and add data to this intent using putExtra
In Unity, retrieve the data from the Intent as shown below
2. Unity (C#) -> Android (Java)
In Android, create a method in UnityPlayerActivity to receive data from Unity. This method can be directly called from Unity as shown in the next section
In Unity, call the method defined in the UnityPlayerActivity with the arguments
Built With
License
This project is licensed under the MIT License - see the LICENSE file for details