Hello Android

This tutorial will show you how to create a simple rotating cube in Unread Engine 4 and deploy it on an Android Device. Prerequisites: had Android SDK, JDK, and Ant installed. You can find a tutori...

Updated over 4 years ago Edit Page Revisions

This tutorial will show you how to create a simple rotating cube in Unread Engine 4 and deploy it on an Android Device.

Prerequisites: had Android SDK, JDK, and Ant installed. You can find a tutorial here. LetÔÇÖs Begin!

Level Setup

Open unreal engine 4 and create a new blank project and call it "HelloAnd". Make sure "Include started content" is unchecked. Unreal will generate a sample level for us, we need to save it. From 'File' menu select Save Make a folder in "HelloAnd/Content" Directory and call it "Levels", choose a name for your level and hit Save. I will call my level "master"

Project Settings

We need to apply some changes to Project Settings

  1. Open Project Settings (Edit -> Project Settings)
  2. Under Description tab you can enter some information about your game.
  3. Under Map & Modes tab you have to change Default map

    Under Default Maps section Change Game Default Map to master by clicking on a button next to Textbox (Ôû╝) and choosing your level name ('master' in my case)
    Do same thing with Editor Startup Map and Server Default Map
    
  4. You need to configure project for Android Platform, Under Android tab there is a Red Warning "Project is not configured for the android platform" and there is "Configure Now" button next to it. Click on "Configure Now" Button.
  • Consider unchecking "Mobile HDR" if your mobile device doesn't support it! (Under Rendering tab, there is 'Mobile section' and a Check box for "Mobile HDR").

File:HelloAnd1.png

File:HelloAnd2.png

File:HelloAnd3.png

Click on "Set as Default" for saving changes. Now we ready to package game for android! Let's dot it!

Packaging Game

Connect your device to your computer. Make sure USB Debug Mode is enabled on the device. Unreal Editor will automatically find your phone and you can deploy your level into your phone. Next to the ÔÇ£Launch" button on Main Editor Window there is drop down menu (Ôû╝) that list all available devices. you should see your computerÔÇÖs name and name of your phone in there. Unreal Engine will automatically deploy current level into your device

File:HelloAndDeploytoAndriod.png

LetÔÇÖs Create our Cube

We need to create a blueprint for our cube. In Content Browser, create new folder and call it "Blueprints". Under Blueprints directory create a new Blueprint and call it "BP_RotatingCube". Open "BP_RotatingCube", under "Components" section we need to add Static Mesh; it will be Root component of our blueprint, Call it MyCube. Under details panel in Static Mesh Section click on little white down pointing triangle (Ôû╝), the tiny version of Content Browser will pop up. There is "View Options" on bottom right, click on it, check the "Show Engine Content" check box. Now we are able to see all Unreal built-in contents. Find Cube (or just simply type cube in search text box).

File:HelloAnd5.png

File:HelloAnd6.png

Go to "Graph" section. Create a new Variable and call it "RotationSpeed" change its default value to 100.0 (You need to compile blueprint for setting default values)

File:HelloAnd7.png

We want to rotate cube around Y axis at constant speed the blueprint for this behavior is looks like this:

File:HelloAnd8.png

Save blueprint.

After saving blueprint you can drag and drop "BP_RotatingCube" blueprint into level. hit Play to see the result.

File:HelloAndFinal.png

For packaging the game and generating actual *.apk file, go to 'File -> Package Project' menus and choose 'Android'. choose destination folder and unreal engine will crate an apk file for you.

File:HelloAnd9.png

Conclusion

We have a beautiful rotating Cube in our android device.

File:HelloAndOnDevice.JPG

(Original Author: )