flutter_embed_unity
2.0.0, released 7 months ago by learntoflutter.com
Embed Unity 3D games and AR experiences as a Flutter widget on iOS and Android.
WASM-ready
What it does
Allows embedding a Unity 3D project as a widget within a Flutter app for iOS and Android. Enables bi-directional messaging between Flutter and Unity scripts, supporting Unity 2022.3 and Unity 6 LTS.
AI-written summary of version 2.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to embed a Unity game or 3D scene inside a Flutter application
- You need to pass messages back and forth between Flutter and Unity scripts
Skip it when
- You need multiple simultaneous instances of Unity running on the same screen
- Your app needs to support older Flutter versions or restricted Unity versions
Strengths
- Brings powerful Unity 3D, AR, and gaming capabilities into Flutter
- Supports bi-directional communication between Flutter and Unity
- Federated architecture allows extension for different Unity versions
Weaknesses
- Only supports a single instance of Unity at a time
- High memory usage and Unity remains in memory even after the widget is disposed
- Strict requirements on Unity versions, Flutter versions, and native Android/iOS settings to avoid crashes
Setup
- Kind
- Plugin (native code)
- Effort
- High
- Code generation
- No
- Direct dependencies
- 3
Requires specific Unity LTS versions, configuring Android activity configChanges, adding UnityFramework.framework in Xcode for iOS, and matching Gradle/NDK/JDK versions.
import 'package:flutter/material.dart';
import 'package:flutter_embed_unity/flutter_embed_unity.dart';
void main() {
runApp(MaterialApp(
home: Scaffold(
body: Column(
children: [
Expanded(
child: EmbedUnity(
onMessageFromUnity: (String message) {},
),
),
],
),
),
));
}