Template:Rating 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!
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"
We need to apply some changes to Project Settings
- Open Project Settings (Edit -> Project Settings…)
- Under Description tab you can enter some information about your game.
- 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
- 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").
Click on "Set as Default" for saving changes. Now we ready to package game for android! Let's dot it!
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
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).
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)
We want to rotate cube around Y axis at constant speed the blueprint for this behavior is looks like this:
After saving blueprint you can drag and drop "BP_RotatingCube" blueprint into level. hit Play to see the result.
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.
We have a beautiful rotating Cube in our android device.
(Original Author: Taesiri)