unity_kit
2.2.0, released 5 weeks ago by ravenlab.tech
Embed Unity 3D in Flutter with a typed bridge and binary protocol.
What it does
Allows embedding Unity 3D as a platform view widget inside Flutter applications. Provides a two-way typed bridge, binary protocol, performance monitoring, AR Foundation integration, and asset streaming across Android, iOS, and Web.
AI-written summary of version 2.2.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to embed an interactive Unity 3D game or scene directly inside a Flutter layout
- You require bi-directional typed messaging or high-frequency binary data exchange between Flutter and Unity
- You are building cross-platform AR applications leveraging Unity AR Foundation from Flutter
Skip it when
- You are building a 2D game in Flutter where pure Dart game engines like Flame are sufficient
- You want a fully working out-of-the-box desktop embedded Unity player view (desktop embedding is currently work in progress)
Strengths
- Provides both JSON message routing and a high-performance binary protocol
- Robust lifecycle state machine with automatic readiness guards and message queuing
- Supports AR Foundation and live performance statistics streaming
Weaknesses
- Complex native setup steps required on both Android and iOS
- Embedded Unity view is not yet fully implemented for desktop platforms (macOS, Windows, Linux)
Setup
- Kind
- Plugin (native code)
- Effort
- High
- Code generation
- No
- Direct dependencies
- 5
Requires Android Gradle and settings modifications for the Unity library, iOS Podfile configuration, exporting and including the Unity project build files, and adding a FlutterBridge GameObject in Unity.
import 'package:unity_kit/unity_kit.dart';
final bridge = UnityBridgeImpl(platform: UnityKitPlatform.instance);
await bridge.initialize();
UnityView(
bridge: bridge,
config: const UnityConfig(sceneName: 'MainScene'),
placeholder: const UnityPlaceholder(message: 'Loading 3D...'),
onReady: (bridge) {
bridge.send(UnityMessage.command('StartGame'));
},
);Alternatives
Packages that do the same job and could replace unity_kit.
Works with
Packages commonly used together with unity_kit: ones it builds on, ones built on it, and its own family.
- cryptounity_kit depends on itProvides SHA, MD5, and HMAC hashing functions for Dart.
- webunity_kit depends on itLightweight bindings for browser APIs via JS interop
- path_providerunity_kit depends on itProvides Flutter APIs to locate common filesystem directories on Android, iOS, macOS, Linux and Windows.
- flutter_plugin_android_lifecycleunity_kit depends on itFlutter plugin for accessing Android Lifecycle within other plugins.