flutter_embed_unity 1.3.1 copy "flutter_embed_unity: ^1.3.1" to clipboard
flutter_embed_unity: ^1.3.1 copied to clipboard

Harness the power of Unity 3D in your Flutter app by embedding Unity as a widget. Useful for adding 3D, gaming or augmented reality (AR) to your app.

1.3.1 #

24 June 2025

  • Production release of support for Unity 6000.0 LTS
  • Merged #45: fixes touch events for Unity 6 on Android (thanks @timbotimbo)
  • Merged #46: fixes messages from Unity not arriving in Flutter when using other plugins which create background Flutter engines (thanks @timbotimbo)
  • Bump flutter_embed_unity_2022_3_android to 1.1.4

Steps to migrate from Unity 2022.3 to Unity 6000.0: #

  • If you are using Android, add the following additional dependency to your pubspec.yaml:
dependencies:
  ...
  # Add this for Unity 6000.0 support on Android:
  flutter_embed_unity_6000_0_android: ^1.2.2  # (Use the latest available)
  • If you are using Android, upgrade your android project's Gradle and AGP to match or exceed those used by Unity 6000.0 and update your NDK version to 27.2.12479018 or higher
  • If you are using Android and you previously copied the aaptOptions block from your Unity export's build.gradle file to your app's build.gradle file to prevent increased load time due to double compression, this has been migrated to an androidResources block. Remove the aaptOptions block from your android/app/build.gradle and replace with:
android {
  ...
  // Syntax for android/app/build.gradle
  androidResources {
    ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~"
    noCompress = ['.unity3d', '.ress', '.resource', '.obb', '.bundle', '.unityexp'] + unityStreamingAssets.tokenize(', ')
  }
}
android {
  ...
  // Syntax for android/app/build.gradle.kts

  androidResources {
    // Read unityStreamingAssets from gradle.properties
    val unityStreamingAssetsList = (project.findProperty("unityStreamingAssets") as? String)
              ?.split(",")
              ?.map { it.trim() }
              ?: emptyList()

    noCompress += listOf(
      ".unity3d", ".ress", ".resource", ".obb", ".bundle", ".unityexp"
    ) + unityStreamingAssetsList

    ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~"
  }
}
  • Migrate your Unity project to Unity 6000.0
  • Update your Unity project's Flutter export scripts by importing the new flutter_embed_unity_6000_0.unitypackage asset from releases on Github
  • Export your Unity project to your Flutter project as before, using the new Unity 6 export scripts
  • If you encounter any build errors, go through the project setup steps in the README again (this has been updated for Unity 6)

1.3.0-beta.1 #

23 May 2025

  • Beta release of support for Unity 6000.0 LTS

Thanks to @timbotimbo for creating the Android platform implementation for Unity 6

Steps to migrate from Unity 2022.3 to Unity 6000.0:

  • If you are using Android, add the following additional dependency to your pubspec.yaml:
dependencies:
  ...
  # Add this for Unity 6000.0 support on Android:
  flutter_embed_unity_6000_0_android: ^1.2.1-beta.1  # (Use the latest available)
  • If you are using Android, upgrade your android project's Gradle and AGP to match or exceed those used by Unity 6000.0 and update your NDK version to 27.2.12479018 or higher
  • If you are using Android and you previously copied the aaptOptions block from your Unity export's build.gradle file to your app's build.gradle file to prevent increased load time due to double compression, this has been migrated to an androidResources block. Remove the aaptOptions block from your android/app/build.gradle and replace with:
  androidResources {
    ignoreAssetsPattern = "!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~"
    noCompress = ['.unity3d', '.ress', '.resource', '.obb', '.bundle', '.unityexp'] + unityStreamingAssets.tokenize(', ')
  }
  • Migrate your Unity project to Unity 6000.0
  • Update your Unity project's Flutter export scripts by importing the new flutter_embed_unity_6000_0.unitypackage asset from releases on Github
  • Export your Unity project to your Flutter project as before, using the new Unity 6 export scripts
  • If you encounter any build errors, go through the project setup steps in the README again (this has been updated for Unity 6)

1.2.7 #

22 May 2025

  • Updated example project to support Flutter 3.29, Gradle 8 Java 11. Bump flutter_embed_unity_2022_3_android to 1.1.3 for the same.
  • Unity export fixed to prevent duplicate namespace being added to unityLibrary/build.gradle when using latest version of Unity 2022.3 (#36 thanks @timbotimbo).
  • Updates to README with alternative gradle modification syntax for Kotlin DSL (#37 thanks @timbotimbo)
  • Unity export improved to automatically remove ndkPath from unityLibrary/build.gradle to prevent build error using latest version with flutter 3.29

To upgrade to the latest Unity export build script for Android, either manually replace the contents of your Unity project's Assets/FlutterEmbed/Editor/ProjectExporterAndroid.cs with the content from the 1.2.7 release branch on Github, or grab the flutter_embed_unity_2022_3.unitypackage asset from 1.2.7 release and re-import into your Unity project

1.2.6 #

21 May 2025

Production release of 1.2.6: Destroy UnityPlayer when the main activity is detached from the plugin to prevent crash when re-opening the app. Fixes #39

1.2.6-beta.2 #

27 March 2025

  • Bump flutter_embed_unity_2022_3_android to 1.1.2-beta.2 to fix: Unload Destroy UnityPlayer when the main activity is detached from the plugin to prevent crash when re-opening the app. Fixes #39 in more scenarios (including when EmbedUnity widget is not at the bottom of the route stack)

1.2.6-beta.1 #

26 March 2025

  • Bump flutter_embed_unity_2022_3_android to 1.1.2-beta.1 to fix: Unload UnityPlayer when the main activity is detached from the plugin to prevent crash when re-opening the app. Fixes #39

1.2.5 #

26 Feb 2025

  • Updated README with more up to date advice regarding Gradle and AGP (see issue #38 - thanks @timbotimbo)

1.2.4 #

23 Dec 2024

  • Updated README with further details on issue #21: workaround available for AR when using Flutter 3.22+ on Android API 32 or earlier (thanks @timbotimbo)

1.2.3 #

2 Aug 2024

  • Lowered Dart SDK constraint to 2.18+ for compatibility with Flutter 3.7

1.2.2 #

31 July 2024

  • Lowered Dart SDK constraint to 2.18+ Fixed in 1.2.3

1.2.1 #

22 July 2024

  • Updated README to note issue #21: AR not supported when using Flutter 3.22 on Android API 32 or less (thanks @timbotimbo)

1.2.0 #

4 July 2024

NOTE: To take advantage of the new automated steps for iOS Unity export, you will need to re-import the latest flutter_embed_unity_2022_3.unitypackage found in Releases - you only need the changes in FlutterEmbed/Editor/ProjectExporterIos.cs

Alternatively, you can simply modify your existing copy of FlutterEmbed/Editor/ProjectExporterIos.cs according to this commit

  • After exporting Unity project for iOS, the manual steps for changing the membership of the Data folder to Unity Framework and adding -Wl,-U,_FlutterEmbedUnityIos_sendToFlutter to Other Linker Flags in Xcode is no longer required (thanks @timbotimbo). See note above.

1.1.1 #

16 May 2024

  • Updated README to add Flutter 3.22 and later to the list of supported versions (3.22 fixes #12 and #14)

1.1.0 #

29 March 2024

1.1.0-beta1 #

13 March 2024

  • New Unity input system touches works on Android

1.0.4 #

4 March 2024

  • Updated README to note that all Unity versions between 2022.3.10 and 2022.3.18 are not supported with Android 8 or earlier due to #15

1.0.3 #

3 March 2024

1.0.2 #

10 January 2024

  • Updated README to note limitation of #12

1.0.1 #

20 November 2023

  • Update Android and iOS platform dependencies to:
    • Fix iOS issue #10
    • Minor change to Android debug logs
  • Updated README with info about #9 (2022.3.9 not compatible with Xcode 15)
  • Upgrade example Unity project version to 2022.3.13 to fix #9

1.0.0 #

12 October 2023

  • First production release
  • Added EmbedUnityPreferences to allow setting Unity message listening behaviour (see the README)

0.0.8-beta #

3 October 2023

  • Update Android and iOS platform dependencies to:
    • Removed green placeholder when Unity is detached from EmbedUnity

0.0.7-beta #

28 September 2023

  • Update Android and platform interface dependency to:
    • Fix issue #5 (Unity freezing on hot reload and widget rebuild)

0.0.6-beta #

27 September 2023

  • Update iOS platform dependency to:
    • Fix issue #6
    • Fix iOS platform package dependency name in iOS example app

0.0.5-beta #

  • Update iOS platform dependency to:
    • Fix issue #3: plugin not working when R8 / minification enabled on Android

0.0.4-beta #

  • Update dependencies

0.0.3-beta #

  • Minor changes to the README

0.0.2-beta #

0.0.1-beta #

  • Initial beta release
31
likes
150
points
413
downloads

Publisher

verified publisherlearntoflutter.com

Weekly Downloads

Harness the power of Unity 3D in your Flutter app by embedding Unity as a widget. Useful for adding 3D, gaming or augmented reality (AR) to your app.

Homepage
Repository (GitHub)
View/report issues

Topics

#unity

Documentation

Documentation
API reference

Funding

Consider supporting this project:

www.buymeacoffee.com

License

MIT (license)

Dependencies

flutter, flutter_embed_unity_2022_3_android, flutter_embed_unity_2022_3_ios, flutter_embed_unity_6000_0_android, flutter_embed_unity_platform_interface

More

Packages that depend on flutter_embed_unity