Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 485
A.Crane Avatar asked Jun 05 '18 22:06

A.Crane


1 Answers

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/

like image 176
ToniTornado Avatar answered Sep 18 '22 06:09

ToniTornado