Advertisement

header ads

Build and run your first Android app with Unity in 15 minutes!



Hello there. Today I'm going to guide you on how to build your very first android app with unity game engine within 15 minutes. Also you can download all softwares which is needed to this development for free! Have yo ever heard about Unity game engine,If not.have you ever heard about an Android game called “Dead Trigger 1 and 2”? if yes,dead trigger game has been developed using Unity game engine. Also most of the smooth and highly graphical games in the Play store and App store has been made with unity. So today you are going to use this awesome game engine to build and run your own app.

Before start you have to download and install following Softwares
  • Android SDK – Download (keep the install path in mind. You have to use it later)
  • JDK – Download
  • Unity Personal Edition – Download

Now install above softwares and SDKs as normal softwares.

  • Now open Unity Engine.
  • Go to files > New Project>set the name “TestApp”>click “create”
  • Change the screen layout for 4 split using layout button



Creating Objects


  • Go to Game Objects >3D object>select “cube”
  • Select cube in Hierarchy panel
  • Go to inspector panel (see below) and set following values:
  • Position: x = 0, y = 0, z = 0
  • Rotation: x = 0, y = 45, z = 45
  • Scale: x = 2, y = 2, z = 2


Select main camera in hierarchy and set following values

  • Position: x = 0, y = 0, z = -5
Go to Game Object>Light>Point Light and edit follows in inspector
  • Position: x = 0, y = 0, z = -5
  • Go to File>Save scene>Give a name and save your scene
  • Then go to File > Save project ans save the project. Remeber to save your project often.


Now lets go further with the design


  • Right click on assets folder > create > Material
  • Then make color to red in inspector
  • Then drag and drop the material file to Cube in Hierarchy
  • Now the cube should be red
  • Then lets animate the cube
  • Right click assets folder > create > C# script; name it as spin
  • Now write click on the C# script file > open;now the script will open in Visual Studio or mono develop
  • Edit the code as follows (make sure to keep the class name similar to the created C# file name). Save it.

using UnityEngine;
using System.Collections;

public class Spin : MonoBehaviour {
    // Use this for initialization
    void Start () {
    }

    // Update is called once per frame
    void Update () {
        // rotate at 90 degrees per second
        transform.Rotate(Vector3.up * Time.deltaTime*90);
    }}
  • Now drag and drop the C# file to cube .
  • Now press the Play button on the top, you will see a spinning red cube on the screen. Press the play button again to stop.


Now lets build the project as an Android APP


  • Go to Edit > Projects settings > Player > go to “Android” tab > other settings
  • Edit the bundle identifier as follows

            com.techmagister.TestApp


  • Now go to Edit > Preferences > External Tools > Brows the SDK installation and give the SDK folder path
  • Now Plug your device to PC
  • Go to your device settings > Find the build number (Usually can found with the android version) > press the build number untile it says “you are now a developer”
  • Then go to settings > developer options > enable USB debugging


  • Now go back to Unity; File > Build and Run
  • At the build settings > select Android and press “build and run” > set TestApp as apk name
  • Now Unity will build the android app and deploy it to your device .
  • Try opening the app from device.

Congratulations!💪 You have completed your 1st App development task with Unity. Now you can try with different settings and effects. Please make a comment if anything need. Like our Facebook page for keep up to date with newest tutorials

Following is the footage of my APP

 

FAQ

  • If deployment getting failed, Try installing USB drivers for the device.
  • Keep the device's screen unlocked while deploying the app.
  • Make sure to edit the C# script correctly.



Post a Comment

0 Comments