Game Framework
CLI ReferenceCommands

game add

Add a Unity or Unreal Engine project to an existing Flutter application without creating a new plugin package.

Usage

game add engine <unity|unreal> [options]

Subcommands

  • engine unity - Add Unity project
  • engine unreal - Add Unreal project

Options

OptionDescriptionDefault
-t, --templateProject template: example or minimalexample
-p, --pathCustom path for engine project<engine>_project
--update-configUpdate or create .game.ymltrue

Examples

Add Unity Project

# Add with example template
game add engine unity

# Add with minimal template
game add engine unity --template minimal

# Add with custom path
game add engine unity --path my_unity_game

# Add without updating config
game add engine unity --no-update-config

Add Unreal Project

# Add Unreal with example template
game add engine unreal

# Add with custom path
game add engine unreal --path my_unreal_game

What It Does

The add engine command:

  1. Creates Engine Project - Adds Unity/Unreal project directory
  2. Copies Template - Uses example or minimal template
  3. Updates Configuration - Creates/updates .game.yml
  4. Adds Solution File - Includes .sln file for Unity (Visual Studio)

Templates

Example Template

Includes full-featured sample project:

  • Complete demo scene/level
  • Sample scripts with communication examples
  • Working example with Game Framework integration
  • Pre-configured for immediate use

Minimal Template

Creates basic starter project:

  • Empty scene/level
  • Essential scripts only
  • Ready for customization
  • Minimal setup

Example template is recommended for learning - it includes working examples of Flutter ↔ Engine communication!

Project Structure

After running game add engine unity:

my_flutter_app/
├── lib/
│   └── main.dart
├── unity_project/          # ← New Unity project
│   ├── Assets/
│   │   └── GameFramework/
│   │       └── Scripts/
│   ├── ProjectSettings/
│   ├── Packages/
│   └── MyGame.sln
├── .game.yml              # ← New or updated config
├── pubspec.yaml
└── ...

Configuration

The command creates/updates .game.yml:

name: my_flutter_app
version: 1.0.0

engines:
  unity:
    project_path: ./unity_project
    export_path: ./unity_project/Exports
    
    platforms:
      android:
        enabled: true
        target_path: android/unityLibrary
      
      ios:
        enabled: true
        target_path: ios/UnityFramework.framework

Use Cases

Add to Existing Flutter App

Perfect for adding game content to an existing app:

cd your_existing_flutter_app
game add engine unity

Test Game Engines

Create a test Flutter project to experiment with engines:

flutter create test_app
cd test_app
game add engine unity
game add engine unreal

Start Fresh

Create a clean engine project for development:

flutter create my_game_app
cd my_game_app
game add engine unity --template minimal

vs scaffold Command

Use game add engine when:

  • Adding to existing Flutter app
  • Want direct control over Flutter project
  • Don't need a publishable plugin package

Use game scaffold when:

  • Creating a publishable plugin package
  • Want package structure with example app
  • Planning to share/publish the package

Next Steps

After adding an engine:

  1. Open in Editor - open unity_project/ or unreal_project/
  2. Make Changes - Customize your game
  3. Export - game export unity --platform android
  4. Sync - game sync unity --platform android
  5. Run - flutter run

Troubleshooting

Directory Already Exists

Error: unity_project directory already exists

Solutions:

  • Use custom path: --path my_custom_unity
  • Remove existing directory
  • Specify different location

Template Download Failed

Error: Failed to download template

Solutions:

  • Check internet connection
  • Try again after a moment
  • Use minimal template if example fails
  • Check GitHub access

Configuration Conflict

Error: .game.yml already exists

Solutions:

  • Manual merge configuration
  • Use --no-update-config to skip
  • Backup and allow overwrite

Engine added successfully? Open it in Unity/Unreal Editor and start creating!