You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: CHANGELOG.md
+1
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,7 @@
9
9
*[Android] Fix touch detection when using Unity's New Input System. [#938](https://github.com/juicycleff/flutter-unity-view-widget/pull/938)
10
10
*[Android] Workaround for mUnityplayer error in Unity plugins using the AndroidJavaProxy. [#908](https://github.com/juicycleff/flutter-unity-view-widget/pull/908)
11
11
*[Android] Add namespace for Android gradle plugin (AGP) 8 compatibility.
12
+
*[Android] Fix kotlin compilation error with Flutter 3.24 and newer. [#973](https://github.com/juicycleff/flutter-unity-view-widget/issues/973)
5. If you use Xcode 14 or newer, and Unity older than 2021.3.17f1 or 2022.2.2f1, your app might crash when running from Xcode.
367
+
5. Unity plugins that make use of native code (Vuforia, openCV, etc.) might need to be added to Runner like UnityFramework.
368
+
Check the contents of the `/ios/UnityLibrary/Frameworks/` directory. Any `<name>.framework` located in (subdirectories of) this directory is a framework that you can add to Runner.
369
+
370
+
6. Make sure pods are installed after your Unity export, either using `flutter run` or by running `pod install` in the ios folder.
371
+
372
+
7. If you use Xcode 14 or newer, and Unity older than 2021.3.17f1 or 2022.2.2f1, your app might crash when running from Xcode.
368
373
Disable the `Thread Performance Checker` feature in Xcode to fix this.
369
374
- In Xcode go to `Product > Scheme > Edit Scheme...`
370
375
- Now With `Run` selected on the left, got to the `Diagnostics` tab and uncheck the checkbox for `Thread Performance Checker`.
@@ -377,30 +382,39 @@ allprojects {
377
382
378
383
The following setup for AR is done after making an export from Unity.
379
384
385
+
<b>Warning: Flutter 3.22 has introduced a crash when using AR on Android < 13 [#957](https://github.com/juicycleff/flutter-unity-view-widget/issues/957)</b>
380
386
381
-
<b>Warning: The `XR Plugin Management` package version `4.3.1 - 4.3.3` has bug that breaks Android exports. </b>
382
-
383
-
- The bug accidentally deletes your AndroidManifest.xml file after each build, resulting in a broken export.
384
-
Switch to version `4.2.2` or `4.4` to avoid this.
385
387
386
388
<details>
387
389
<summary>:information_source: <b>AR Foundation Android</b></summary>
388
390
389
-
7. Open the *lib/__architecture__/* folder and check if there are both *libUnityARCore.so* and *libarpresto_api.so* files.
390
-
There seems to be a bug where a Unity export does not include all lib files. If they are missing, use Unity to build a standalone .apk
391
-
of your AR project, unzip the resulting apk, and copy over the missing .lib files to the `unityLibrary` module.
392
-
393
-
8. Repeat steps 5 and 6 from the Android <b>Platform specific setup</b> (editing build.gradle and settings.gradle), replacing `unityLibrary` with `arcore_client`, `unityandroidpermissions` and `UnityARCore`.
394
-
395
-
9. When using `UnityWidget` in Flutter, set `fullscreen: false` to disable fullscreen.
391
+
1. Check the version of the `XR Plugin Management` in the Unity package manager. Versions `4.3.1 - 4.3.3` contain a bug that breaks Android exports.
392
+
Make sure to use a version <=`4.2.2` or >=`4.4`.
393
+
You might have to manually change the version in `<unity project>/Packages/manifest.json` for `"com.unity.xr.management"`.
394
+
395
+
396
+
2. You can check the `android/unityLibrary/libs` folder to see if AR was properly exported. It should contain files similar to `UnityARCore.aar`, `ARPresto.aar`, `arcore_client.aar` and `unityandroidpermissions.aar`.
397
+
398
+
If your setup and export was done correctly, your project should automatically load these files.
399
+
If it doesn't, check if your `android/build.gradle` file contains the `flatDir` section added in the android setup step 7.
400
+
401
+
3. If your `XR Plugin Management` plugin is version 4.4 or higher, Unity also exports the xrmanifest.androidlib folder.
402
+
Make sure to include it by adding the following line to `android/settings.gradle`
403
+
```
404
+
include ":unityLibrary:xrmanifest.androidlib"
405
+
```
406
+
4. With some Unity versions AR might crash at runtine with an error like:
407
+
`java.lang.NoSuchFieldError: no "Ljava/lang/Object;" field "mUnityPlayer" in class`.
408
+
See the Android setup step 3 on how to edit your MainActivity to fix this.
396
409
397
410
-----
398
411
</details>
399
412
400
413
<details>
401
414
<summary>:information_source: <b>AR Foundation iOS</b></summary>
402
-
7. Open the *ios/Runner/Info.plist* and change the following:
403
415
416
+
1. Open the *ios/Runner/Info.plist* and add a camera usage description.
417
+
For example:
404
418
```diff
405
419
<dict>
406
420
+ <key>NSCameraUsageDescription</key>
@@ -413,28 +427,45 @@ Switch to version `4.2.2` or `4.4` to avoid this.
Thanks to [@PiotrxKolasinski](https://github.com/PiotrxKolasinski) for writing down the exact steps:
430
+
1. Your export should contain a Vuforia library in the `android/unityLibrary/libs/` folder. Currently named `VuforiaEngine.aar`.
431
+
432
+
If your setup and export was done correctly, your project should automatically load this file.
433
+
If it doesn't, check if your `android/build.gradle` file contains the `flatDir` section added in the android setup step 7.
434
+
435
+
In case this gets outdated or broken, check the [Vuforia documentation](https://developer.vuforia.com/library/unity-extension/using-vuforia-engine-unity-library-uaal#android-specific-steps)
7. Open the *android/unityLibrary/build.gradle* file and change the following:
443
+
These steps are based on these [Vuforia docs](https://developer.vuforia.com/library/unity-extension/using-vuforia-engine-unity-library-uaal#ios-specific-steps)and [this comment](https://github.com/juicycleff/flutter-unity-view-widget/issues/314#issuecomment-785302253)
419
444
445
+
1. Open the *ios/Runner/Info.plist* and add a camera usage description.
In `Frameworks, Libraries, and Embedded content` add the Vuforia frameworks. This is where you added *UnityFramework.framework* in step 4 of the iOS setup.
424
456
425
-
8. Using Android Studio, go to **File > Open** and select the *android/* folder. A
426
-
new project will open.
427
-
428
-
> Don't worry if the error message "Project with path ':VuforiaWrapper' could not be
429
-
> found in project ':unityLibrary'" appears. The next step will fix it.
3. To support Vuforia target databases, move the `Unity-iPhone/Vuforia` folder from Unity-iPhone to Runner. Then set `Target Membership` of this folder to Runner.
464
+
465
+
4. Make sure pods are installed after your Unity export, either using `flutter run` or by running `pod install` in the ios folder.
430
466
431
-
9. In this new project window, go to **File > New > New Module > Import .JAR/.AAR package**
432
-
and select the *android/unityLibrary/libs/VuforiaWrapper.aar* file. A new folder
433
-
named *VuforiaWrapper* will be created inside *android/*. You can now close this
434
-
new project window.
435
-
436
467
-----
437
-
</details>
468
+
</details>
438
469
439
470
## Emulators
440
471
We recommend using a physical iOS or Android device, as emulator support is limited.
0 commit comments