Building a mobile app lets you run your Unity game on phones and tablets. It turns your project into an app you can install and play.
0
0
Mobile build (Android/iOS) in Unity
Introduction
You want to test your game on a real Android or iOS device.
You want to share your game with friends or publish it on app stores.
You want to use mobile features like touch controls or sensors.
You want to make sure your game works well on small screens.
You want to create a standalone app that runs outside the Unity editor.
Syntax
Unity
1. Open Unity Editor. 2. Go to File > Build Settings. 3. Select Android or iOS platform. 4. Click Switch Platform. 5. Set Player Settings (app name, icon, version). 6. Connect your device or set up emulator. 7. Click Build or Build and Run. 8. Save the app file (.apk for Android, .ipa for iOS). 9. Install and test on your device.
You must install Android SDK/NDK and Xcode for Android and iOS builds respectively.
Switching platform may take some time as Unity prepares assets.
Examples
This builds your Unity project into an Android app (.apk file).
Unity
File > Build Settings > Select Android > Switch Platform > Build
This builds and runs your Unity project on a connected iOS device or simulator.
Unity
File > Build Settings > Select iOS > Switch Platform > Build and RunSample Program
This script prints a message to the console when the app starts on a mobile device.
Unity
// This is a simple Unity C# script to show a message on mobile build using UnityEngine; public class HelloMobile : MonoBehaviour { void Start() { Debug.Log("Hello, mobile build!"); } }
OutputSuccess
Important Notes
Make sure your device is in developer mode to install apps directly.
For iOS, you need an Apple developer account and a Mac with Xcode installed.
Test your app on different devices to check performance and controls.
Summary
Mobile build turns your Unity project into an app for Android or iOS devices.
Use Build Settings to switch platform and create the app file.
Test your app on real devices to ensure it works well.