gameframework 0.0.3 copy "gameframework: ^0.0.3" to clipboard
gameframework: ^0.0.3 copied to clipboard

A unified, modular framework for embedding multiple game engines (Unity, Unreal Engine) into Flutter applications with bidirectional communication and lifecycle management.

Game Framework #

A unified, modular framework for embedding multiple game engines (Unity, Unreal Engine, and potentially others) into Flutter applications.

pub package pub points popularity License: MIT Platform


โœจ Features #

  • ๐ŸŽฎ Unified API - One interface for all game engines
  • ๐Ÿ”Œ Modular Architecture - Plug in only the engines you need
  • โ†”๏ธ Bidirectional Communication - Flutter โ†” Engine messaging
  • โ™ป๏ธ Lifecycle Management - Automatic pause/resume/destroy
  • ๐Ÿ“ฑ Multi-Platform - Android & iOS (Web/Desktop coming soon)
  • ๐Ÿ›ก๏ธ Type-Safe - Full Dart type safety
  • ๐Ÿš€ Production-Ready - Export automation, validation, and tooling
  • ๐Ÿ“– Well-Documented - 3,400+ lines of documentation

๐Ÿš€ Quick Start #

1. Add Dependencies #

dependencies:
  gameframework: ^0.0.2
  gameframework_unity: ^0.0.2
  gameframework_stream: ^0.0.2  # Optional: for asset streaming

Or install from the command line:

flutter pub add gameframework
flutter pub add gameframework_unity

2. Initialize Engine Plugin #

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());
}

3. Embed Engine in Your App #

class GameScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: GameWidget(
        engineType: GameEngineType.unity,
        onEngineCreated: (controller) {
          controller.sendMessage('GameManager', 'Start', 'level1');
        },
        onMessage: (message) {
          print('Message from engine: ${message.data}');
        },
      ),
    );
  }
}

That's it! See QUICK_START.md for detailed instructions.


๐Ÿ“ฆ Supported Engines #

Engine Status Platforms Version
Unity โœ… Production (Android, iOS)
๐Ÿšง WIP (Web, Desktop)
Android, iOS, Web*, macOS*, Windows*, Linux* 2022.3.x
Unreal Engine ๐Ÿšง WIP (Android, iOS) Android*, iOS* 5.x

* = Work in Progress


๐Ÿ—๏ธ Architecture #

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚              Flutter Application                 โ”‚
โ”‚                                                  โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚  โ”‚  GameWidget (Unified API)                  โ”‚ โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚                โ”‚                                 โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚  โ”‚  GameEngineController (Interface)          โ”‚ โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                 โ”‚
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ”‚                 โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚Unity Plugin  โ”‚  โ”‚Unreal Plugin โ”‚
โ”‚              โ”‚  โ”‚   (Soon)     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
        โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚    Native Bridge                 โ”‚
โ”‚  (Android/iOS)                   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
        โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚    Game Engine                   โ”‚
โ”‚  (Unity/Unreal)                  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“š Documentation #

Getting Started #

Unity Integration #

Architecture & Design #


๐ŸŽฏ Use Cases #

Mobile Gaming #

Embed Unity/Unreal games directly in your Flutter app:

GameWidget(
  engineType: GameEngineType.unity,
  config: GameEngineConfig(fullscreen: true),
)

AR Experiences #

Build AR apps with AR Foundation:

GameWidget(
  engineType: GameEngineType.unity,
  onEngineCreated: (controller) {
    controller.sendMessage('ARManager', 'StartAR', '');
  },
)

Interactive Content #

Mix game content with Flutter UI:

Column(
  children: [
    Expanded(child: GameWidget(...)),
    ControlPanel(), // Your Flutter UI
  ],
)

๐Ÿ› ๏ธ Unity Integration #

Export Your Unity Project #

  1. Add Flutter scripts to your Unity project
  2. In Unity menu: Flutter > Export for Flutter
  3. Select Android and/or iOS
  4. Export to your Flutter project

Validate Your Project #

  1. In Unity menu: Flutter > Validate Project
  2. Fix any issues with one-click fixes
  3. Ready to export!

See Unity Plugin Guide for details.


๐Ÿ’ฌ Communication #

Flutter โ†’ Unity #

// Simple message
await controller.sendMessage('Player', 'Jump', '10.5');

// JSON message
await controller.sendJsonMessage('GameManager', 'UpdateScore', {
  'score': 100,
  'stars': 3,
});

Unity โ†’ Flutter #

// Simple message
FlutterBridge.Instance.SendToFlutter("GameManager", "onReady", "true");

// JSON message
var data = new GameData { score = 100, level = 5 };
FlutterBridge.Instance.SendToFlutter("GameManager", "onUpdate", data);

๐ŸŽ“ Example #

Run the included example to see it in action:

cd example
flutter run

The example demonstrates:

  • โœ… Engine initialization
  • โœ… Lifecycle management
  • โœ… Bidirectional communication
  • โœ… Event logging
  • โœ… UI controls

๐Ÿ“Š Project Status & Roadmap #

Current Version: 0.0.2

โœ… Production Ready #

  • Unity: Android, iOS
  • Core Framework: All platforms
  • Quality: Type-safe API, comprehensive tests, clean static analysis

๐Ÿšง Work in Progress #

  • Unity: Web, macOS, Windows, Linux
  • Unreal: Android, iOS

๐Ÿ“‹ Roadmap #

  • Near-term:

    • Complete Unity desktop (macOS, Windows, Linux) support
    • Complete Unity Web/WebGL support
    • Complete Unreal Engine mobile (Android, iOS) integration
  • Mid-term:

    • Unreal desktop & web support
    • Advanced asset streaming features
    • Performance optimization tools
  • Long-term:

    • Additional game engine integrations
    • Cloud services integration
    • v1.0 Production release

๐Ÿค Contributing #

Contributions are welcome! Please read our Contributing Guide first.

Areas We Need Help #

  • Testing on various devices
  • Additional game engine integrations
  • Documentation improvements
  • Example projects

๐Ÿ“‹ Requirements #

Flutter #

  • Flutter 3.10.0 or higher
  • Dart 3.0.0 or higher

Android #

  • minSdkVersion: 21 (Android 5.0)
  • targetSdkVersion: 33
  • Kotlin 1.8+
  • Gradle 8.0+

iOS #

  • iOS 12.0 or higher
  • Swift 5.0+
  • Xcode 14.0+

Unity #

  • Unity 2022.3.x or 2023.1.x
  • IL2CPP scripting backend recommended

๐Ÿ“„ License #

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ“ž Support #



Made with ๐ŸŽฎ for Flutter game developers

0
likes
150
points
76
downloads

Publisher

verified publisherxraph.com

Weekly Downloads

A unified, modular framework for embedding multiple game engines (Unity, Unreal Engine) into Flutter applications with bidirectional communication and lifecycle management.

Repository (GitHub)
View/report issues
Contributing

Topics

#game-engine #unity #unreal-engine #game-development #augmented-reality

Documentation

Documentation
API reference

License

MIT (license)

Dependencies

flutter, flutter_plugin_android_lifecycle, plugin_platform_interface

More

Packages that depend on gameframework

Packages that implement gameframework