Game Framework
CLI ReferenceCommands

game build

Export game, sync files, and build Flutter app in one command. Perfect for streamlining your development workflow.

Usage

game build <platform> --engine <engine> [options]

Arguments

  • <platform> - Target platform: android, ios, macos, windows, linux

Options

OptionDescriptionDefault
--engine, -eEngine to build: unity or unreal(required)
--development, -dDevelopment buildfalse
--releaseRelease buildtrue
--skip-exportSkip game export stepfalse
--skip-syncSkip file sync stepfalse
--config, -cPath to .game.ymlauto-detect

Examples

Full Build Pipeline

# Build Android with Unity
game build android --engine unity

# Build iOS with Unreal
game build ios --engine unreal

# Development build
game build android --engine unity --development

Skip Steps

# Skip export if already done
game build android --engine unity --skip-export

# Skip sync if files are current
game build android --engine unity --skip-sync

# Only build Flutter (skip both)
game build android --engine unity --skip-export --skip-sync

What It Does

The build command performs three steps:

  1. Export (unless --skip-export)

    • Runs game export <engine> --platform <platform>
    • Builds game from Unity/Unreal
  2. Sync (unless --skip-sync)

    • Runs game sync <engine> --platform <platform>
    • Copies exported files to Flutter project
  3. Build

    • Runs flutter build <platform>
    • Creates final Flutter application

This single command replaces three separate commands - perfect for rapid iteration!

Build Targets

Android

game build android --engine unity

Creates: build/app/outputs/flutter-apk/app-release.apk

iOS

game build ios --engine unity

Creates: build/ios/iphoneos/Runner.app

iOS builds require macOS and Xcode.

Desktop Platforms

# macOS
game build macos --engine unity

# Windows
game build windows --engine unity

# Linux
game build linux --engine unity

Development vs Release

Development Build

game build android --engine unity --development

Characteristics:

  • Faster build times
  • Debug symbols included
  • Larger file size
  • Better error messages

Release Build (Default)

game build android --engine unity --release

Characteristics:

  • Optimized for performance
  • Smaller file size
  • Code obfuscation
  • Production-ready

Configuration

Configure in .game.yml:

engines:
  unity:
    project_path: ../MyUnityProject
    export_path: ../MyUnityProject/Exports
    
    export_settings:
      development: false
      build_configuration: Release
    
    platforms:
      android:
        enabled: true
        target_path: android/unityLibrary

Workflow Examples

Daily Development

# Make changes in Unity
# ...

# Build and test
game build android --engine unity
flutter install

Multi-Platform Build

# Build for all platforms
game build android --engine unity
game build ios --engine unity
game build macos --engine unity

Incremental Builds

# First build (full pipeline)
game build android --engine unity

# Subsequent builds (skip export if no game changes)
game build android --engine unity --skip-export

Performance Tips

Skip Unnecessary Steps

If you haven't changed the game:

game build android --engine unity --skip-export --skip-sync

This only runs flutter build which is much faster.

Use Development Builds

During development:

game build android --engine unity --development

Development builds are faster than release builds.

Cache Exports

Don't clean export directories unnecessarily - engines cache build artifacts for faster subsequent exports.

Troubleshooting

Build Failed

Check each step individually:

# Test export
game export unity --platform android

# Test sync
game sync unity --platform android

# Test Flutter build
flutter build apk

Stale Files

Use clean sync:

# First, manually clean
game sync unity --platform android --clean

# Then build
game build android --engine unity --skip-export

Configuration Issues

Validate configuration:

game config validate

Next Steps

After building:

  1. Test on device - flutter install
  2. Run app - flutter run --release
  3. Publish - Deploy to app stores or use game publish

Build complete? Test with flutter install or deploy to app stores!