Game Framework
SDK Documentation

SDK Overview

The Game Framework SDK is a Flutter package that provides a unified API for embedding Unity and Unreal Engine games into Flutter applications.

Core Packages

gameframework

The core package provides:

  • GameWidget - Universal widget for all engines
  • GameEngineController - Unified controller interface
  • GameEngineRegistry - Plugin registration system
  • Platform interfaces for Android, iOS, desktop
flutter pub add gameframework

gameframework_unity

Unity Engine integration plugin:

  • Unity-specific controller implementation
  • Platform view integration
  • Message protocol adapters
  • Native bridge for all platforms
flutter pub add gameframework_unity

gameframework_unreal

Unreal Engine integration plugin:

  • Unreal-specific controller implementation
  • Platform view integration
  • Blueprint communication support
  • Native bridge for all platforms
flutter pub add gameframework_unreal

Quick Example

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('From engine: ${message.data}');
        },
      ),
    );
  }
}

Key Features

Unified API

Single interface works with all game engines - write once, support multiple engines

Bidirectional Communication

Type-safe messaging between Flutter and game engines with high performance

Lifecycle Management

Automatic handling of pause, resume, and dispose events

Multi-Platform

Android, iOS, macOS, Windows, Linux support with platform-optimized implementations

Architecture

graph TB
    subgraph FlutterApp[Flutter Application]
        GameWidget[GameWidget]
        Controller[GameEngineController]
    end
    
    subgraph CoreSDK[gameframework]
        Registry[GameEngineRegistry]
        Platform[Platform Interface]
    end
    
    subgraph Plugins[Engine Plugins]
        UnityPlugin[gameframework_unity]
        UnrealPlugin[gameframework_unreal]
    end
    
    subgraph Native[Native Bridges]
        UnityNative[Unity Native]
        UnrealNative[Unreal Native]
    end
    
    GameWidget --> Controller
    Controller --> Registry
    Registry --> Platform
    Platform --> UnityPlugin
    Platform --> UnrealPlugin
    UnityPlugin --> UnityNative
    UnrealPlugin --> UnrealNative

Core Concepts

GameWidget

The main UI component for displaying game engines:

GameWidget(
  engineType: GameEngineType.unity,
  config: GameEngineConfig(
    runImmediately: true,
    fullscreen: false,
  ),
  onEngineCreated: (controller) {},
  onMessage: (message) {},
)

GameEngineController

Controls the engine lifecycle and communication:

// Send messages
controller.sendMessage('Target', 'Method', 'Data');

// Lifecycle
controller.pause();
controller.resume();
controller.dispose();

Communication

Multiple message formats supported:

  • String messages - Simple text
  • JSON messages - Structured data
  • Binary protocol - High performance

Platform Support

PlatformStatusNotes
AndroidStableAPI 22+, ARM64 recommended
iOSStableiOS 12.0+
macOSBetamacOS 10.14+
WindowsBetaWindows 10+
LinuxBetaUbuntu 20.04+

Documentation

Installation

See the Installation Guide for complete setup instructions.

Ready to start? Check out the Quick Start Guide!