Is it possible to embed a Unity game into a Flutter app?

16,670

You can imagine the whole Flutter app to be rendered on one view of the final native application. It can coexist with native views. So it should definitely be possible to display a native Android/iOS view with Unity content and trigger that from Flutter.

  1. Create a Flutter project and open the Android native part of it (right click the android folder in Android Studio, choose Flutter -> Open Android module).
  2. Create a native Android view there and use platform channels to display it.
  3. Add Unity content to the native view.

https://flutter.io/platform-channels/

Share:
16,670
A.Crane
Author by

A.Crane

Updated on June 16, 2022

Comments

  • A.Crane
    A.Crane almost 2 years

    I am creating an app that will require small mini-games as a menu option, and I have created these games in Unity. Ideally, I would like to embed these games into a Flutter project. I have seen tutorials on doing this with Java and Android Studio, and I need to make a decision on which platform I will be using for my internship project. I have several questions about the SDK, but I have posted them separately to keep the answers distinct (and help filter out the noise for anyone searching for these specific answers), and this is one of my main questions.

    Specifically, I am following this guide: https://medium.com/@davidbeloosesky/embedded-unity-within-android-app-7061f4f473a for Android Studio, and was wondering if something similar was possible with Flutter. I am also using Android Studio as my IDE for Flutter, but need to decide if I should stick with Java, or switch to Dart and Flutter (which actually works much better for specific UI elements I need).

    If not, is there another way to package a Unity project and a Flutter application together?