Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 60fb4c7

Browse files
Update documentation for ArFoundation and Vuforia.
1 parent 45fffb5 commit 60fb4c7

File tree

1 file changed

+58
-28
lines changed

1 file changed

+58
-28
lines changed

‎README.md

Lines changed: 58 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,9 @@ allprojects {
364364

365365
<img src="https://github.com/juicycleff/flutter-unity-view-widget/blob/master/files/libraries.png" width="400" />
366366

367-
5. If you use Xcode 14 or newer, and Unity older than 2021年3月17日f1 or 2022年2月2日f1, 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月17日f1 or 2022年2月2日f1, your app might crash when running from Xcode.
368370
Disable the `Thread Performance Checker` feature in Xcode to fix this.
369371
- In Xcode go to `Product > Scheme > Edit Scheme...`
370372
- 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 {
377379

378380
The following setup for AR is done after making an export from Unity.
379381

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>
380383

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.
385384

386385
<details>
387386
<summary>:information_source: <b>AR Foundation Android</b></summary>
388387

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.
396406
397407
-----
398408
</details>
399409
410+
</details>
411+
400412
<details>
401413
<summary>:information_source: <b>AR Foundation iOS</b></summary>
402-
7. Open the *ios/Runner/Info.plist* and change the following:
403414
415+
1. Open the *ios/Runner/Info.plist* and add a camera usage description.
416+
For example:
404417
```diff
405418
<dict>
406419
+ <key>NSCameraUsageDescription</key>
@@ -413,28 +426,45 @@ Switch to version `4.2.2` or `4.4` to avoid this.
413426
<details>
414427
<summary>:information_source: <b>Vuforia Android</b></summary>
415428

416-
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`.
417430

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.
419433

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)
435+
436+
-----
437+
</details>
438+
439+
<details>
440+
<summary>:information_source: <b>Vuforia iOS</b></summary>
441+
442+
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.
445+
For example:
420446
```diff
421-
- implementation(name: 'VuforiaWrapper', ext: 'aar')
422-
+ implementation project(':VuforiaWrapper')
447+
<dict>
448+
+ <key>NSCameraUsageDescription</key>
449+
+ <string>$(PRODUCT_NAME) uses Cameras</string>
450+
</dict>
423451
```
452+
2. In Xcode,
453+
Select `Runner` > `General` tab.
454+
In `Frameworks, Libraries, and Embedded content` add the Vuforia frameworks. This is where you added *UnityFramework.framework* in step 4 of the iOS setup.
424455

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.
456+
You should be able to find them in
457+
`/ios/UnityLibrary/Frameworks/com.ptc.vuforia.engine/Vuforia/Plugins/iOS/`.
458+
Currently these are
459+
- `Vuforia.framework`
460+
- `UnityDriver.framework`
461+
462+
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.
430465

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-
436466
-----
437-
</details>
467+
</details>
438468

439469
## Emulators
440470
We recommend using a physical iOS or Android device, as emulator support is limited.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /