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
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. Make sure pods are installed after your Unity export, either using `flutter run` or by running `pod install` in the ios folder.
368
+
369
+
6. 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
370
Disable the `Thread Performance Checker` feature in Xcode to fix this.
369
371
- In Xcode go to `Product > Scheme > Edit Scheme...`
370
372
- Now With `Run` selected on the left, got to the `Diagnostics` tab and uncheck the checkbox for `Thread Performance Checker`.
@@ -377,30 +379,41 @@ allprojects {
377
379
378
380
The following setup for AR is done after making an export from Unity.
379
381
382
+
<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
383
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
384
386
385
<details>
387
386
<summary>:information_source: <b>AR Foundation Android</b></summary>
388
387
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.
388
+
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.
389
+
Make sure to use a version <=`4.2.2` or >=`4.4`.
390
+
You might have to manually change the version in `<unity project>/Packages/manifest.json` for `"com.unity.xr.management"`.
391
+
392
+
393
+
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`.
394
+
395
+
If your setup and export was done correctly, your project should automatically load these files.
396
+
If it doesn't, check if your `android/build.gradle` file contains the `flatDir` section added in the android setup step 7.
397
+
398
+
3. If your `XR Plugin Management` plugin is version 4.4 or higher, Unity also exports the xrmanifest.androidlib folder.
399
+
Make sure to include it by adding the following line to `android/settings.gradle`
400
+
```
401
+
include ":unityLibrary:xrmanifest.androidlib"
402
+
```
403
+
4. With some Unity versions AR might crash at runtine with an error like:
404
+
`java.lang.NoSuchFieldError: no "Ljava/lang/Object;" field "mUnityPlayer" in class`.
405
+
See the Android setup step 3 on how to edit your MainActivity to fix this.
396
406
397
407
-----
398
408
</details>
399
409
410
+
</details>
411
+
400
412
<details>
401
413
<summary>:information_source: <b>AR Foundation iOS</b></summary>
402
-
7. Open the *ios/Runner/Info.plist* and change the following:
403
414
415
+
1. Open the *ios/Runner/Info.plist* and add a camera usage description.
416
+
For example:
404
417
```diff
405
418
<dict>
406
419
+ <key>NSCameraUsageDescription</key>
@@ -413,28 +426,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:
429
+
1. Your export should contain a Vuforia library in the `android/unityLibrary/libs/` folder. Currently named `VuforiaEngine.aar`.
417
430
418
-
7. Open the *android/unityLibrary/build.gradle* file and change the following:
431
+
If your setup and export was done correctly, your project should automatically load this file.
432
+
If it doesn't, check if your `android/build.gradle` file contains the `flatDir` section added in the android setup step 7.
419
433
434
+
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)
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)
443
+
444
+
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
455
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.
463
+
464
+
4. Make sure pods are installed after your Unity export, either using `flutter run` or by running `pod install` in the ios folder.
430
465
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
466
-----
437
-
</details>
467
+
</details>
438
468
439
469
## Emulators
440
470
We recommend using a physical iOS or Android device, as emulator support is limited.
0 commit comments