Game Framework
CLI ReferenceCommands

game sync

Sync exported game files from Unity or Unreal Engine to your Flutter project. Can also sync Game Framework plugin scripts to Unity projects.

Usage

Sync Exported Files

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

Sync Plugin Scripts (Unity)

game sync scripts [options]

Sync Exported Files

Arguments

  • <engine> - Engine type: unity or unreal

Options

OptionDescriptionDefault
--platform, -pTarget platform(s)(required)
--allSync all enabled platformsfalse
--cleanDelete target directory before syncingfalse
--config, -cPath to .game.ymlauto-detect

Examples

# Sync Unity Android files
game sync unity --platform android

# Sync Unreal iOS files (clean first)
game sync unreal --platform ios --clean

# Sync all enabled Unity platforms
game sync unity --all

# Sync with custom config
game sync unity --platform android --config /path/to/.game.yml

What It Syncs

Unity:

  • Android: Copies unityLibrary folder to android/
  • iOS/macOS: Copies UnityFramework.framework to ios/ or macos/
  • Windows/Linux: Copies build directory

Unreal:

  • Android: Extracts APK, copies .so libraries and assets to android/app/src/main
  • iOS: Extracts IPA, copies UnrealFramework.framework to ios/
  • macOS: Copies .app bundle or framework
  • Windows/Linux: Copies packaged build

Sync Plugin Scripts

Sync Game Framework Unity plugin scripts to your Unity project.

Options

OptionDescriptionDefault
--project, -pPath to Unity projectfrom .game.yml
--target-dir, -tTarget directory in AssetsGameFramework
--templatesInclude template examplesfalse
--cleanClean target directory firstfalse
--dry-runPreview without copyingfalse

Examples

# Sync using .game.yml config
game sync scripts

# Sync with explicit path
game sync scripts --project ~/UnityProjects/MyGame

# Include template examples
game sync scripts --templates --clean

# Dry run to preview changes
game sync scripts --dry-run

What Gets Synced

Core Scripts:

  • FlutterMonoBehaviour - Base class for Unity scripts
  • MessageRouter - Message handling and routing
  • MessagePool - Object pooling for performance
  • MessageBatcher - Batch message processing
  • BinaryMessageProtocol - High-performance binary messaging

Optional (with --templates):

  • GameFrameworkDemo.cs - Complete demo example
  • RotatingCube.cs - Simple 3D example
  • MessagingExample.cs - Communication examples

Features

  • Auto-download - Downloads from GitHub if not found locally
  • Smart detection - Finds existing Game Framework folder
  • No duplicates - Won't create conflicts
  • Streaming-aware - Excludes Addressables unless streaming is enabled

Scripts are automatically downloaded from the latest gameframework repository if not found locally!

Configuration

Configure sync paths in .game.yml:

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

Troubleshooting

Export Directory Not Found

Error: Export directory not found

Solution: Run game export first before game sync:

game export unity --platform android
game sync unity --platform android

Target Path Not Found

Error: Target path does not exist

Solutions:

  • Ensure Flutter project structure is correct
  • Verify target_path in .game.yml
  • Create directories if needed: mkdir -p android/

Permission Denied

Error: Permission denied

Solutions:

  • Check file permissions
  • Run with appropriate permissions
  • Ensure no files are locked/in use

Files Already Exist

Warning: Target files already exist

Solutions:

  • Use --clean flag to delete existing files first
  • Manually remove the target directory
  • Verify you're syncing the correct files

Clean Sync

For release builds or when you want a fresh copy:

game sync unity --platform android --clean

This:

  1. Deletes the target directory
  2. Copies fresh files from export
  3. Ensures no stale files remain

Next Steps

After syncing:

  1. Run your Flutter app with flutter run
  2. Build for release with flutter build
  3. Test on device - Deploy to physical devices

Files synced successfully? Try flutter run to test your integrated app!