A unified, modular framework for embedding multiple game engines (Unity, Unreal Engine) into Flutter applications with bidirectional communication and lifecycle management.
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 bootstrapThis single command resolves all dependencies for all packages in the workspace.
Add to your pubspec.yaml:
dependencies:
gameframework: ^0.0.2
gameframework_unity: ^0.0.2 # If using Unity
gameframework_stream: ^0.0.2 # If using asset streaming
# gameframework_unreal: ^0.0.2 # If using Unreal (WIP)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 bootstrapmake 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 packagemake analyze # Static analysis for all packages
make format # Format all code
make format-check # Check formatting without changes
make lint # Run format check + analyze + testmake doctor # Check Flutter and dependencies
make list-packages # List all workspace packages
make version # Show versions of all packages
make coverage # Generate coverage reportsmake 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 testmake 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-allThe 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.2
- Unity: Android, iOS
- Core Framework: All platforms
- Unity: Web, macOS, Windows, Linux
- Unreal: Android, iOS
- Complete Unity desktop & web support
- Complete Unreal Engine mobile integration
- Unreal desktop & web support
- Advanced streaming features
- Performance optimization tools
- v1.0 Production release
| Platform | gameframework | Unity | Unreal | Status |
|---|---|---|---|---|
| Android | ✅ Ready | ✅ Ready | 🚧 WIP | Stable |
| iOS | ✅ Ready | ✅ Ready | 🚧 WIP | Stable |
| Web | ✅ Ready | 🚧 WIP | ⏳ Planned | Beta |
| 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 coverageExample 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.2
- gameframework_stream: 0.0.2
- gameframework_unity: 0.0.2
- gameframework_unreal: 0.0.2
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.