A unified, modular framework for embedding multiple game engines (Unity, Unreal Engine) into Flutter applications with bidirectional communication and lifecycle management.
|
|
|
| Unity in Flutter | Unreal Engine in Flutter |
Game Framework provides a consistent API for integrating game engines into Flutter applications. Built as a Dart workspace monorepo, it includes:
- gameframework - Core framework package with unified engine API
- gameframework_unity - Unity Engine integration plugin
- gameframework_unreal - Unreal Engine integration plugin
- example - Demo application showcasing framework capabilities
- Unified API - Single interface for all game engines
- Modular Architecture - Use only the engines you need
- Bidirectional Communication - Flutter ↔ Engine messaging with type safety
- Lifecycle Management - Automatic pause/resume/destroy handling
- Multi-Platform - Android, iOS, macOS, Windows, Linux support
- Production Ready - Comprehensive testing and documentation
gameframework-workspace/
├── pubspec.yaml # Workspace configuration
├── Makefile # Build automation
├── packages/
│ └── gameframework/ # Core framework
│ ├── lib/ # Dart API
│ ├── android/ # Android platform code
│ ├── ios/ # iOS platform code
│ └── pubspec.yaml # v0.0.1
├── engines/
│ ├── unity/
│ │ ├── dart/ # Unity plugin package
│ │ └── plugin/ # Unity C# scripts
│ └── unreal/
│ ├── dart/ # Unreal plugin package
│ └── plugin/ # Unreal C++ plugin
└── example/ # Example application
└── pubspec.yaml
- Flutter SDK >= 3.3.0
- Dart SDK >= 3.6.0
- Unity 2022.3.x or Unreal Engine 5.x (depending on your needs)
- Clone the repository:
git clone https://github.com/xraph/gameframework.git
cd gameframework- Bootstrap the workspace:
make bootstrap
This single command resolves all dependencies for all packages in the workspace.
Add to your pubspec.yaml:
dependencies: gameframework: ^0.0.3 gameframework_unity: ^0.0.4 # If using Unity gameframework_stream: ^0.0.3 # If using asset streaming # gameframework_unreal: ^0.0.3 # If using Unreal
import 'package:flutter/material.dart'; import 'package:gameframework/gameframework.dart'; import 'package:gameframework_unity/gameframework_unity.dart'; void main() { WidgetsFlutterBinding.ensureInitialized(); UnityEnginePlugin.initialize(); runApp(MyApp()); } class GameScreen extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( body: GameWidget( engineType: GameEngineType.unity, config: GameEngineConfig( runImmediately: true, ), onEngineCreated: (controller) { controller.sendMessage('GameManager', 'Start', 'level1'); }, onMessage: (message) { print('Message from engine: ${message.data}'); }, ), ); } }
The Makefile provides comprehensive workspace management:
make bootstrap # Resolve all workspace dependencies make setup # Alias for bootstrap
make test # Run tests for all packages make gameframework # Test core package only make unity # Test Unity plugin only make unreal # Test Unreal plugin only make test-package PKG=packages/gameframework # Test specific package
make analyze # Static analysis for all packages make format # Format all code make format-check # Check formatting without changes make lint # Run format check + analyze + test
make doctor # Check Flutter and dependencies make list-packages # List all workspace packages make version # Show versions of all packages make coverage # Generate coverage reports
make clean # Clean all build artifacts make clean-deep # Deep clean (removes all generated files)
# Work on gameframework package cd packages/gameframework flutter test flutter analyze # Work on Unity plugin cd engines/unity/dart flutter test
make example # Run example app make build-android # Build Android APK make build-ios # Build iOS (macOS only)
make publish-check # Validate all packagesPackages must be published in dependency order:
# Publish core framework first make publish-gameframework # Then publish engine plugins make publish-unity make publish-unreal # Or publish all in order make publish-all
The core package provides:
GameWidget- Universal widget for all enginesGameEngineController- Engine lifecycle and communicationGameEngineRegistry- Engine plugin registration- Platform-specific implementations for Android, iOS, macOS, Windows, Linux
Each engine plugin (Unity, Unreal) implements:
- Engine-specific controller
- Platform view integration
- Bidirectional messaging
- Lifecycle management
Flutter App
↕ (MethodChannel)
GameWidget (gameframework)
↕ (Platform Interface)
Engine Plugin (gameframework_unity/unreal)
↕ (Native Bridge)
Game Engine (Unity/Unreal)
Current Version: 0.0.3
- Unity: Android, iOS
- Core Framework: All platforms
- Unreal: Android, iOS
- Unity: Web, macOS, Windows, Linux
- Harden Unreal Engine mobile integration
- Complete Unity desktop & web support
- Unreal desktop & web support
- Advanced streaming features
- Performance optimization tools
- v1.0 Production release
| Platform | gameframework | Unity | Unreal | Status |
|---|---|---|---|---|
| Android | ✅ Ready | ✅ Ready | 🟢 Beta | Stable |
| iOS | ✅ Ready | ✅ Ready | 🟢 Beta | Stable |
| Web | ✅ Ready | ✅ Ready | ⏳ Planned | Stable |
| macOS | ✅ Ready | 🚧 WIP | ⏳ Planned | Beta |
| Windows | ✅ Ready | 🚧 WIP | ⏳ Planned | Beta |
| Linux | ✅ Ready | 🚧 WIP | ⏳ Planned | Beta |
The Makefile includes CI-optimized commands:
make ci # Run all CI checks (format, analyze, test) make check # Run quality checks with coverage
Example GitHub Actions workflow:
name: CI on: [push, pull_request] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: subosito/flutter-action@v2 - run: make bootstrap - run: make ci
- MONOREPO_MAKEFILE.md - Comprehensive Makefile guide
- QUICK_START.md - Detailed quick start guide
- packages/gameframework/README.md - Core package documentation
- engines/unity/dart/README.md - Unity plugin documentation
- engines/unreal/dart/README.md - Unreal plugin documentation
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
- Fork and clone the repository
- Create a feature branch:
git checkout -b feature/my-feature - Make changes and add tests
- Run quality checks:
make lint - Commit changes:
git commit -m "Add my feature" - Push to your fork:
git push origin feature/my-feature - Open a Pull Request
- Follow Dart style guide
- Maintain test coverage above 80%
- Add documentation for public APIs
- Run
make lintbefore committing
All packages use semantic versioning (semver). Current versions:
- gameframework: 0.0.3
- gameframework_stream: 0.0.3
- gameframework_unity: 0.0.4
- gameframework_unreal: 0.0.3
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: docs.gameframework.dev
- Flutter team for the excellent framework
- Unity Technologies and Epic Games for their game engines
- Contributors and community members
Note: This is a monorepo managed with Dart workspaces. All packages share dependencies and can be developed together. Use the provided Makefile commands for workspace operations.

