The creation of mobile games is experiencing a real renaissance, and the engine Unity remains the undisputed leader in this area. Its popularity is due to its powerful tools, cross-platform functionality and a huge community of developers. If you are wondering how to make games using Unity for Android, then you are on the right track: this engine allows you to create projects of any complexity, from simple hyper-casual clickers to full-fledged 3D open-world shooters.
However, the path from an idea to a finished application in the Google Play Store is thorny and requires not only a creative approach, but also a deep understanding of the technical part. You will have to deal with setting up the environment, optimizing for thousands of different smartphone models, and the specifics of mobile control. Unlike development for a PC, here every megabyte of memory and every percentage of battery charge is critical.
In this article we will analyze in detail the entire development cycle: from the correct installation of modules to the final assembly of the release build. We will not delve into the basics of programming in C#, but will focus specifically on the specifics of the platform Android within the Unity ecosystem. This guide will help you avoid common beginner mistakes and save hours of debugging.
Preparing the environment and installing modules
The first step is to correctly install the engine itself. On startup Unity Hub you must select the LTS (Long Term Support) version, as it provides maximum stability. In the engine version installation window, it is critical not to miss the checkbox next to the module Android Build Support. Without this component, you simply cannot assemble a project for the mobile platform.
Together with the main assembly module, you will be automatically prompted to install two additional components: Android SDK & NDK Tools and OpenJDK. Agree to install them, as they are the foundation for compiling code into a format understandable by the Android operating system. Manually setting paths to these tools often leads to compatibility errors, so using Unity's built-in tools is the most reliable option.
โ ๏ธ Warning: Make sure there is enough free space on the drive where Unity is installed. A full installation with all modules for Android can take more than 15-20 GB, and lack of space during the installation process often leads to corrupted SDK files.
After installation, you should check the paths to the tools in the editor settings. Go to menu Edit โ Preferences โ External Tools. Here you will see a section Androidwhere the paths to the SDK, NDK and JDK should be specified. If the fields are empty or highlighted in red, click the button Browse and specify the folders inside the Unity installation directory (usually a path like Unity/Hub/Editor/Version/Editor/Data/PlaybackEngines/AndroidPlayer/Tools).
If you are using a third-party version of Android Studio, make sure that the NDK and SDK versions in it match those that your version of Unity expects, otherwise there will be conflicts during the build.
Project setup and switching platform
After creating a new project or opening an existing one, the first thing you need to do is tell the engine which platform we will work on. By default, Unity creates projects for PC. To change this, open the window File โ Build Settings. In the list of platforms, find the logo Android, select it and click the button Switch Platform.
The switching process may take several minutes, since the engine needs to recompile assets and configure internal parameters for the ARM architecture. Don't interrupt this process. Once completed, you will see an Android icon in the upper right corner of the editor, which confirms the successful change of target. Now all rendering and input settings will be adapted for mobile devices.
In the same Build Settings window, it is important to configure the company and product parameters. Fields Company Name and Product Name affect the folder structure when installing the game on the device. Also set here Package Name โa unique identifier for your application (for example, com.yourstudio.supergame). This identifier cannot be changed after publishing the game to the store, so choose it carefully.
โ๏ธ Initial project setup
Pay special attention to the section Player Settings, which opens with a button next to the assembly settings. There are hundreds of parameters here, but only a few are important to get started. The tab Other Settings contains the field Minimum API Level. It is recommended to set the value to at least Android 7.0 (API Level 24) to cover the majority of active devices while maintaining access to modern system features.
Graphics optimization and resource management
Mobile devices have limited resources compared to personal computers. The main task of the developer is to ensure stable FPS (frames per second) and minimal power consumption. The key tool here is adjusting the graphics quality. In Unity, this is the responsibility of the component Quality Settings, accessible through the menu Edit โ Project Settings โ Quality.
For mobile games, heavy effects such as real-time shadows or complex lighting are often disabled. Instead, they use Baked Lighting, which is pre-calculated and stored in textures, without loading the processor during gameplay. You should also be careful about texture resolution: using 4K images for objects on a small smartphone screen is a waste of RAM.
| Quality setting | Impact on performance | Recommendation for Android |
|---|---|---|
| Shadows (Shadows) | High | Use Hard Shadows or disable |
| Anti-Aliasing | Medium | 2x or 4x MSAA, not higher |
| Textures | Depends on VRAM | Maximum 2048x2048, ASTC compression |
| Post-processing | Very high | Minimize or use mobile profile |
Another important aspect is memory management. Constant loading and unloading of resources can cause freezes (slowdowns). Use the system Asset Bundles or Addressables to dynamically load levels. This allows you to break the game into parts and download them only as needed, reducing the initial size of the APK file.
What are "Draw Calls" and why is it important?
Draw Call is a command to the processor to draw an object. The more objects with different materials on the screen, the more commands there are. On mobile devices, the number of Draw Calls should be minimal (preferably up to 100-200 per frame), otherwise the processor will not be able to process the geometry.
Adaptation of controls for the touch screen
Transferring controls from the keyboard and mouse to the touch screen is not just replacing buttons, it is changing the logic of interaction. In Unity, the system Input System (new) or legacy Input Manager. For mobile projects, the new input system is preferable, as it works better with multi-touch and virtual joysticks.
You need to create UI elements for control: virtual sticks for movement and buttons for actions. It is important to consider that the user's fingers cover part of the screen. The interface should be ergonomic: the main action buttons are located in the lower right zone, and motion controls are located in the left. Do not place important controls in the upper corners, as they are difficult to reach with your thumb on modern large smartphones.
To implement a virtual joystick, you can use ready-made assets from the Asset Store or write a simple script that tracks touch coordinates (Input.touches). The script must calculate the displacement vector of the finger from the point of initial pressing and transmit it to the character controller. Don't forget to add visual feedback - highlighting the buttons when pressed so that the player understands that the controls work.
โ ๏ธ Attention: Be sure to test the controls on real devices with different screen diagonals. What is comfortable on a 6-inch screen may be uncomfortable on a tablet or small budget smartphone.
Working with SDK, NDK and third-party plugins
A modern mobile game rarely exists in a vacuum. Most often, integration of advertising, analytics, in-game purchases or social functions is required. For this, various SDK (Software Development Kit) are used. In Unity, most of them come as ready-made packages or plugins that are imported into the project.
When importing plugins such as Google AdMob, Unity Ads or Firebase, additional customization of the application manifest is often required. Manifest (AndroidManifest.xml) informs the Android system about the necessary permissions (internet access, geolocation, vibration feedback). Unity allows you to edit the manifest through code or special plugin settings windows. Make sure that library versions do not conflict with each other, as this is a common cause of startup crashes.
Particular attention should be paid to Internet access permissions. By default, in new versions of Unity it can be disabled to save traffic. If your game requires a network, go to Player Settings โ Other Settings โ Configuration and make sure that the parameter Internet Access is set to Require. Otherwise, on the device, the game simply will not be able to connect to the server.
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
This code demonstrates basic permissions, which are often added to the manifest manually if the plugin does not do this automatically. Working with NDK (Native Development Kit) is required less frequently, mainly when using ready-made libraries in C++, but Unity takes on most of this work when building the project.
Building, testing and publishing APK/AAB
The final stage is compiling the project into an installation file. In the window Build Settings you can select the output format. Historically, the format has been used APK, but Google Play now requires downloading the format AAB (Android App Bundle). AAB allows the store to optimize the size of the application for a specific user device, cutting off unnecessary resources.
For local testing, it is convenient to use the function Build And Run. If your smartphone is connected via USB and has USB debugging enabled (in the developer menu), Unity will automatically compile the game, install it on the device and launch it. This significantly speeds up the iteration process: made a change to the code โ pressed a button โ checked on the phone.
Before the final assembly for the store, you need to configure Keystore (key storage). This is a digital certificate file that your application signs. Without it, you will not be able to update the game in the future. Create a new file in the Player settings (Publishing Settings section), set a strong password and save the file in a safe place. Losing the key means that it is impossible to release updates for an already published game.
AAB format is required for new applications on Google Play from August 2021. The old APK format is accepted only for internal tests or updates to old projects.
After receiving the file .aab or signed .apk, you can proceed to upload to the Google Play developer console. Please remember that the moderation process can take anywhere from a few hours to a few days. Before sending, be sure to test the build on several devices with different versions of Android to eliminate critical bugs.
How to enable developer mode on Android?
Go to Phone Settings โ About phone. Find "Build Number" and quickly click on it 7 times in a row. A notification โYou have become a developerโ will appear. After this, a new section โFor Developersโ will appear in the main settings menu, where you need to activate โUSB Debuggingโ.
Why does the game crash immediately after launching on the phone?
The most common reasons: mismatch of the Android version (Minimum API Level is too high), lack of necessary permissions in the manifest, conflicting versions of SDK libraries or an error in the native code of the plugin. Connect your phone to your PC and view the logs via Window โ Analysis โ Device Log Unity.
Is it possible to test the game without a real smartphone?
Yes, you can use emulators (for example, BlueStacks or the built-in Android Studio emulator). However, emulators do not always correctly reflect the performance and operation of touch controls, so final testing on real hardware is mandatory.
What is the difference between IL2CPP and Mono?
Mono is a standard backend, fast compilation, but lower performance and code protection. IL2CPP converts C# code to C++ and then to machine code. This gives a speed boost and protects the game logic from hacking, but increases build time. For release on Android, it is recommended to use IL2CPP.