Building & Publishing
Take your finished game from the Unity Editor to the real world — build for PC, Android, WebGL, and iOS, then publish for players to enjoy.
Build Settings Window
The Build Settings window is your launch pad. It is where you choose which platform to build for and which scenes to include.
- Open File > Build Settings (or press Ctrl+Shift+B / Cmd+Shift+B).
- At the top, you will see Scenes In Build. Click Add Open Scenes to add your current scene. If you have multiple scenes (e.g., a Loading scene and a Game scene), add them all. The first scene in the list (index 0) is the one that loads on startup.
- On the left, you will see a list of platforms: PC/Mac/Linux, Android, iOS, WebGL, and more. The active platform has the Unity logo next to it.
- To switch platforms, select the target platform and click Switch Platform. Unity will reimport assets for the new platform — this can take several minutes the first time.
You can only build for platforms whose modules are installed. If you do not see Android or WebGL in the list, go back to Unity Hub > Installs, click the gear icon on your Unity version, select Add Modules, and install the platform you need (e.g., "Android Build Support," "WebGL Build Support"). You will need to restart Unity after installing.
Player Settings
Player Settings control how your built game presents itself to the player — the app name, icon, resolution, and more. Open them via Edit > Project Settings > Player (or click Player Settings... in the Build Settings window).
General Settings (All Platforms)
| Setting | What to Set | Example |
|---|---|---|
| Company Name | Your name or studio name. Used in the file path for save data. | NimritaGames |
| Product Name | The game's display name. This is what appears on the home screen or desktop. | Infinite Runner |
| Version | Semantic versioning (major.minor.patch). | 1.0.0 |
Icon Setup
- In Player Settings, scroll to the Icon section (platform-specific tabs at the top).
- For Android, you need multiple icon sizes (from 48x48 to 432x432). Drag your icon image into the Default Icon slot and Unity will scale it for each size. For best results, provide the largest size (512x512 or 1024x1024).
- For iOS, you need even more sizes. Unity shows each required size — fill them all.
- For PC, a single 256x256 icon works. Drag it into the Default Icon.
Resolution and Presentation
- Default Orientation (mobile): Set to Portrait for an infinite runner (phone held upright). Some runners use Landscape — choose what fits your game.
- Fullscreen Mode (PC): "Fullscreen Window" is the safest option for modern PCs.
- Default Screen Width/Height (PC): 1920x1080 is standard.
- Run In Background: Uncheck for mobile (saves battery). Check for PC if the player might alt-tab.
Splash Screen
If you use Unity Personal (free), Unity requires a splash screen with the "Made with Unity" logo. You can customize the background color and add your own logo alongside Unity's. With Unity Pro or Plus, you can disable the Unity splash entirely.
- In Player Settings > Splash Image, set the Background Color to match your game's theme.
- Add your game's logo under Logos > click + and drag your logo sprite.
- Set Draw Mode to "Unity Logo Below" or "All Sequential."
Building for PC / Mac
PC is the simplest platform to build for. No special SDKs, no signing, no store requirements.
- Open File > Build Settings.
- Select Windows, Mac, Linux as the platform. Click Switch Platform if it is not already active.
- Choose your Target Platform: Windows, macOS, or Linux.
- Choose Architecture: x86_64 (64-bit) is standard for modern systems.
- Click Build (or Build and Run to launch immediately after building).
- Choose a folder for the build output (e.g.,
Builds/Windows/). Unity creates an executable and a Data folder.
Distributing Your PC Build
The simplest way to share a PC build is to zip the entire build folder and upload it somewhere players can download it.
itch.io (Recommended for Indie Games)
- Create a free account at itch.io.
- Click Dashboard > Create new project.
- Fill in the game details: title, description, tags, cover image.
- Set Kind of project to "Downloadable."
- Under Uploads, upload your zipped build folder. Tag it with the platform (Windows, Mac, Linux).
- Set the project to Public and click Save.
- Share your itch.io page link with the world!
itch.io provides a command-line tool called butler that lets you push builds from a terminal. It is faster than the web upload, supports incremental uploads (only pushes changed files), and can be integrated into automated build pipelines. For now, the web upload is perfectly fine.
Building for Android
Android is the most popular platform for infinite runners. The setup takes a few extra steps, but Unity handles most of the complexity for you.
Installing Android Build Support
- Open Unity Hub > Installs.
- Click the gear icon on your Unity version and select Add Modules.
- Check Android Build Support. Also check Android SDK & NDK Tools and OpenJDK (Unity installs these automatically so you do not need to manage them yourself).
- Click Install and wait for the download to complete. Restart Unity.
Android Player Settings
- In Build Settings, select Android and click Switch Platform.
- Click Player Settings and navigate to the Android tab (the green robot icon).
-
Other Settings:
- Package Name: A unique identifier in reverse-domain format, e.g.,
com.yourname.infiniterunner. This MUST be unique on the Google Play Store. - Minimum API Level: Set to API Level 24 (Android 7.0) or higher. This is the minimum Android version your game supports. Lower values support more devices but limit available features.
- Target API Level: Set to the highest available (Google Play requires targeting recent API levels).
- Scripting Backend: Set to IL2CPP (required by Google Play for 64-bit support and better performance than Mono).
- Target Architectures: Check both ARM64 and ARMv7. ARM64 is required by Google Play. ARMv7 supports older devices.
- Package Name: A unique identifier in reverse-domain format, e.g.,
Keystore for Signing
Android apps must be digitally signed. For development, Unity uses a debug keystore automatically. For publishing to the Google Play Store, you need a release keystore.
- In Player Settings > Publishing Settings, check Custom Keystore.
- Click Keystore Manager (or create a new keystore).
- Choose Create New, pick a file location, and set:
- Password: A strong password (write it down and store it safely!).
- Alias: A name for the key (e.g., "release").
- Alias Password: Can be the same as the keystore password.
- Validity (years): 25 (Google requires at least 25 years).
- Click Create. Unity generates the keystore file.
If you lose your keystore file or forget the password, you can never update your app on the Google Play Store. Google identifies your app by its signing key. Losing it means starting over with a new listing. Back up the keystore file and passwords in a secure location (e.g., a password manager or encrypted cloud storage).
Building APK vs. AAB
- APK (Android Package): A standalone file you can install directly on a device. Good for testing.
- AAB (Android App Bundle): The format required by Google Play. It lets Google optimize the download size for each device. Select Build App Bundle (Google Play) in Build Settings.
- In Build Settings, click Build.
- Choose an output location. Unity will generate an .apk or .aab file.
-
To test on a real device (APK):
- Enable Developer Options on your Android phone (Settings > About Phone > tap "Build Number" 7 times).
- Enable USB Debugging in Developer Options.
- Connect your phone via USB. Your computer should detect it.
- In Build Settings, click Build and Run. Unity installs the APK directly to the connected device and launches it.
Building for WebGL
WebGL builds let people play your game in a web browser — no download required. This is fantastic for sharing your game quickly and for embedding on game portals.
- In Build Settings, select WebGL and click Switch Platform.
- In Player Settings for WebGL:
- Resolution: Set a default canvas size (e.g., 960x600 for a landscape browser window, or 540x960 for portrait).
- WebGL Template: Use "Minimal" or "Default." The Minimal template is a clean page with just the game canvas.
- Compression Format: Set to Gzip for hosting on servers that support it, or Disabled if your host does not support compression headers (GitHub Pages needs Disabled or Brotli).
- Data Caching: Enable this so returning players do not re-download the entire game.
- Click Build. Choose an output folder (e.g.,
Builds/WebGL/). - Unity generates an
index.htmlfile and aBuild/folder containing the game data.
Hosting on itch.io
- Zip the entire WebGL build folder (the one containing
index.html). - On your itch.io project page, upload the zip.
- Check This file will be played in the browser.
- Set the viewport dimensions to match your game's resolution.
- Save and test — your game is now playable in the browser!
Hosting on GitHub Pages
- Create a GitHub repository for your game (or use an existing one).
- Push the WebGL build output to the repository (the
index.htmlandBuild/folder should be in the root, or in adocs/folder). - Go to your repository's Settings > Pages.
- Set the source to the branch and folder where your build files are.
- GitHub provides a URL like
https://yourusername.github.io/your-repo/. - If the game does not load, check the browser console for errors. A common issue is compression — set Compression Format to Disabled in Player Settings and rebuild.
WebGL builds have some restrictions compared to native builds: no multithreading (by default), no direct file system access (your save system will need to use PlayerPrefs or the IndexedDB via JavaScript interop instead of File.WriteAllText), and no access to native plugins. Also, build sizes can be large — strip unused code via Player Settings > Other Settings > Managed Stripping Level = Medium to reduce the download size.
Building for iOS (Overview)
Building for iOS requires specific hardware and accounts. Here is an overview of the process:
Requirements
- A Mac computer running macOS (iOS builds cannot be made on Windows).
- Xcode installed from the Mac App Store (free).
- An Apple Developer Account ($99/year) for distributing on the App Store. A free account works for testing on your own device.
Basic Steps
- On your Mac, open your Unity project and switch to the iOS platform in Build Settings.
- Configure Player Settings:
- Bundle Identifier:
com.yourname.infiniterunner(must match your Apple Developer portal). - Target minimum iOS Version: 14.0 or higher.
- Signing Team ID: Your Apple Developer team ID.
- Bundle Identifier:
- Click Build. Unity generates an Xcode project (not a final app).
- Open the generated Xcode project (
.xcodeprojfile) in Xcode. - In Xcode, select your signing team, connect your iPhone, and click Run to install on the device.
- For App Store distribution, create an archive in Xcode and upload via App Store Connect.
If you do not have a Mac, focus on Android and WebGL. Both platforms reach a massive audience. You can always add iOS later when you have access to the required hardware. Some developers use cloud Mac services (like MacinCloud or GitHub Actions with macOS runners) to build iOS projects remotely.
Pre-Build Checklist
Before creating your final build, run through this checklist to catch common issues:
Code Cleanup
// OPTION 1: Use conditional compilation to strip Debug.Log from release builds.
// Debug.Log calls are surprisingly expensive — each one allocates strings
// and can cause frame drops on mobile.
// Wrap debug logs in #if UNITY_EDITOR or #if DEVELOPMENT_BUILD
#if UNITY_EDITOR
Debug.Log("This only runs in the Editor");
#endif
// OPTION 2: Create a custom logger that compiles away in release builds
public static class GameLogger
{
[System.Diagnostics.Conditional("UNITY_EDITOR")]
[System.Diagnostics.Conditional("DEVELOPMENT_BUILD")]
public static void Log(string message)
{
Debug.Log(message);
}
[System.Diagnostics.Conditional("UNITY_EDITOR")]
[System.Diagnostics.Conditional("DEVELOPMENT_BUILD")]
public static void LogWarning(string message)
{
Debug.LogWarning(message);
}
// Debug.LogError should ALWAYS work — you want to know about errors
// even in release builds.
public static void LogError(string message)
{
Debug.LogError(message);
}
}
// Usage: Replace Debug.Log with GameLogger.Log throughout your project.
// In release builds, GameLogger.Log calls are completely stripped by the compiler.
// GameLogger.LogError still works everywhere.
Full Checklist
| Category | Item |
|---|---|
| Code | Remove or wrap all Debug.Log statements |
| Code | Delete any test/debug scripts (GameManagerTester, etc.) |
| Code | Verify no compiler warnings in the Console |
| Functionality | Test all features end-to-end: menu, gameplay, pause, game over, restart |
| Functionality | Verify the save system works (play a game, close the app, reopen — high score should persist) |
| Functionality | Test on minimum-spec target device |
| Performance | Run the Profiler and verify no major spikes (see Chapter 24) |
| Performance | Check draw call count on target device |
| Audio | Verify music and SFX play correctly and respect volume settings |
| UI | Test on different aspect ratios (16:9, 18:9, 20:9 for modern phones) |
| UI | Verify UI scales correctly on small and large screens |
| Build | Scenes In Build list is correct (right scenes, right order) |
| Build | Player Settings are configured (name, icon, version, orientation) |
| Build | Keystore is configured (Android only) |
Reducing Build Size
A smaller build downloads faster and is more likely to be installed. Here are key strategies:
- Texture Compression: Use ASTC (Android/iOS) and DXT (PC). Set Max Size to the minimum that still looks good (often 512x512 or 256x256 for mobile).
- Audio Compression: In the Audio Clip import settings, set music to Vorbis (compressed) with quality 50–70%. Set short SFX to ADPCM (fast decompression, smaller than PCM).
- Managed Stripping Level: In Player Settings > Other Settings, set to Medium or High. This strips unused C# code from the build. If you get runtime errors, lower the stripping level.
- Remove Unused Assets: Delete any assets you are not using (unused textures, models, audio clips). They may still be included in the build if referenced anywhere.
- Analyze Build Report: After building, check the Editor.log file. Search for "Build Report" to see a breakdown of which assets consume the most space. The largest culprits are usually textures and audio.
On Windows: %LOCALAPPDATA%\Unity\Editor\Editor.log. On macOS: ~/Library/Logs/Unity/Editor.log. Open it in a text editor and search for "Build Report" to see a per-asset size breakdown.
What's Next?
Congratulations! You have built a complete, production-quality infinite runner from scratch. But the journey does not have to end here. There are many features you could add to take your game to the next level:
Features to Add
| Feature | Description | Difficulty |
|---|---|---|
| Multiple Characters | Let players unlock and play as different characters with unique models and abilities. | Medium |
| Themes / Environments | Different visual themes (city, forest, space) that change the world generation. | Medium |
| Daily Challenges | Timed events with special rules and rewards. | Medium |
| Leaderboards | Online high scores using Unity Gaming Services or Firebase. | Hard |
| Achievements | "Run 10,000 meters total," "Collect 500 coins in one run," etc. | Medium |
| Ads (Monetization) | Rewarded video ads ("Watch an ad to continue") using Unity Ads or AdMob. | Medium |
| In-App Purchases | Coin packs, ad removal, exclusive characters using Unity IAP. | Hard |
| Power-Ups | Magnet (auto-collect coins), shield (survive one hit), 2x score multiplier. | Medium |
| Missions / Quests | "Collect 30 coins in one run" for bonus rewards. | Medium |
| Haptic Feedback | Phone vibration on coin collect, crash, etc. (mobile only). | Easy |
Where to Learn More
- Unity Learn (learn.unity.com) — Free official tutorials and courses on every Unity topic.
- Unity Documentation (docs.unity3d.com) — The official API reference. Bookmark this — you will use it constantly.
- Catlike Coding (catlikecoding.com) — Excellent in-depth tutorials on advanced Unity topics.
- Game Programming Patterns by Robert Nystrom (free online at gameprogrammingpatterns.com) — The definitive book on patterns like the ones we used (Singleton, State, Observer, Object Pool).
- Unity Forums and Reddit (r/Unity3D, r/gamedev) — Communities where you can ask questions and share your work.
Congratulations!
You did it. Over 25 chapters, you went from zero to a fully-featured infinite runner game. Let us recap everything you built:
- Part 1 (Foundations) — Set up Unity, learned the Editor, wrote your first C# code, and planned your project architecture.
- Part 2 (Core Systems) — Built a Game Manager with a state machine, an event system for decoupled communication, input handling for swipe and keyboard, a responsive player controller, and a smooth camera system.
- Part 3 (World Generation) — Created an infinite world with chunk-based generation, object pooling for zero-allocation runtime performance, procedural world layout, and origin shifting for floating-point precision.
- Part 4 (Gameplay) — Designed obstacles with different dodge patterns, collectible coins, a scoring system, and a difficulty curve that ramps up over time.
- Part 5 (Polish) — Added a complete UI system, audio with music and sound effects, particle effects for visual juice, and a full animation system with blend trees.
- Part 6 (Ship It) — Built a save system for persistent data, optimized performance for mobile, and learned how to build and publish for PC, Android, WebGL, and iOS.
You did not just follow tutorials — you learned production-grade patterns that professional game developers use every day. The Singleton pattern, the State pattern, event-driven architecture, object pooling, and separation of concerns are skills that transfer to every game you will ever build.
The most important step in game development is finishing and releasing. Most game projects are abandoned before they are done. You now have the knowledge and the code to ship a real game. Do not wait until it is "perfect" — publish it, get feedback, and iterate. The first version is never the last. Ship it, learn from players, and build version 2. The world needs your game.
Thank you for following this entire guide. Now go build something amazing.
This is it. The final commit. Your game is complete.
git add .
git commit -m "Complete infinite runner - ready for release"
git push
Run git log --oneline one last time. Look at that history — from "Initial project setup" to "Complete infinite runner." Every commit represents a system you built, a concept you learned, and a problem you solved. You didn't just build a game. You learned production-grade version control along the way. You created branches, merged features, pushed to GitHub, and built a clean commit history that any professional team would be proud of. That's not just a game — that's a portfolio piece.
One final git concept — tags. Tags mark specific commits as release versions:
git tag v1.0.0
git push --tags
v1.0.0 marks this as your first release. If you ever need to find the exact state of your game at launch, git checkout v1.0.0 will take you right there.