Unity-Technologies / arfoundation-samples

Example content for Unity projects based on AR Foundation
Other
3.05k stars 1.14k forks source link

Empty Reference Image Library in Asset Bundle [Bug] #521

Closed JannickLeismann closed 4 years ago

JannickLeismann commented 4 years ago

When importing an asset bundle that contains a scene that uses arfoundation + tracker the associated reference image library is empty (textures are not lying in StreamingAssets folder).

Is it however working for anyone?

ArFoundation 3.01

Unity 2019.2.17f1

nilsk123 commented 4 years ago

When importing an asset bundle that contains a scene that uses arfoundation + tracker the associated reference image library is empty (textures are not lying in StreamingAssets folder).

Is it however working for anyone?

ArFoundation 3.01

Unity 2019.2.17f1

you can add reference images at runtime that weren't in the build by using this API

https://docs.unity3d.com/Packages/com.unity.xr.arfoundation@3.0/manual/tracked-image-manager.html#adding-new-reference-images-at-runtime

JannickLeismann commented 4 years ago

Hi thanks for your reply, I know that this is a workaround but this is still an issue since loading asset bundles into an ar application is a common case and by using an already created library it would be an out-of-the-box solution

nilsk123 commented 4 years ago

Hi thanks for your reply, I know that this is a workaround but this is still an issue since loading asset bundles into an ar application is a common case and by using an already created library it would be an out-of-the-box solution

The problem here is that regular reference image libraries assume the reference images to be in the apps baked in asset catalog which can not be written to at runtime. The same limitation exists in Google's and Apple's native frameworks as far as I know.

Basically assetbundles aren't capable of writing to the part of the system that you are attempting to write to. This isn't a problem specific to ARFoundation. To solve your problem you'll have to rethink your approach, and use the suitable API's I linked to before.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

pinnakkkk commented 1 year ago

@tdmowrer any update on this? The docs for AR Foundation 4.2 say's its possible to load an XR Reference Image Library via the asset bundle. When I try to download the library from cloud & load it in the editor, it works. Even the library has the image in it, however on Android Build i get these errors. Unity: 2021.3.0f1 AR Foundation: 4.2

2023/02/02 17:14:36.458 23610 23647 Error Unity InvalidOperationException: Failed to load XRReferenceImageLibrary 'UpdatedReferenceImageLibrary': library does not contain any ARCore data.
2023/02/02 17:14:36.458 23610 23647 Error Unity   at UnityEngine.XR.ARCore.ARCoreImageDatabase..ctor (UnityEngine.XR.ARSubsystems.XRReferenceImageLibrary serializedLibrary) [0x00000] in <00000000000000000000000000000000>:0 
2023/02/02 17:14:36.458 23610 23647 Error Unity   at UnityEngine.XR.ARCore.ARCoreImageTrackingSubsystem+ARCoreProvider.CreateRuntimeLibrary (UnityEngine.XR.ARSubsystems.XRReferenceImageLibrary serializedLibrary) [0x00000] in <00000000000000000000000000000000>:0 
2023/02/02 17:14:36.458 23610 23647 Error Unity   at UnityEngine.XR.ARSubsystems.XRImageTrackingSubsystem.CreateRuntimeLibrary (UnityEngine.XR.ARSubsystems.XRReferenceImageLibrary serializedLibrary) [0x00000] in <00000000000000000000000000000000>:0 
2023/02/02 17:14:36.458 23610 23647 Error Unity   at UnityEngine.XR.ARFoundation.ARTrackedImageManager.set_referenceLibrary (UnityEngine.XR.ARSubsystems.IReferenceImageLibrary value) [0x00000] in <00000000000000000000000000000000>:0 
2023/02/02 17:14:36.458 23610 23647 Error Unity   at PinaksARImageTracker+<ee>d__7.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
2023/02/02 17:14:36.458 23610 23647 Error Unity   at U
2023/02/02 17:14:36.480 23610 23759 Error native E0000 00:00:1675338276.480156   23759 motion_tracking_context.cc:1879] NOT_FOUND: Failed to find an image with the requested timestamp.
2023/02/02 17:14:36.480 23610 23759 Error native === Source Location Trace: ===
2023/02/02 17:14:36.480 23610 23759 Error native third_party/redwood/perception/feature_processing/image_buffer.cc:41
2023/02/02 17:14:36.480 23610 23759 Error native third_party/arcore/ar/perception/feature_track_ml_depth_provider.cc:168
2023/02/02 17:14:38.803 23610 23854 Info native I0000 00:00:1675338278.802925   23854 motion_analysis_calculator.cc:650] Analyzed frame 101
2023/02/02 17:14:42.530 23610 23854 Info native I0000 00:00:1675338282.530258   23854 motion_analysis_calculator.cc:650] Analyzed frame 201
2023/02/02 17:14:44.151 23610 23741 Info native I0000 00:00:1675338284.150964   23741 performance_monitor.cc:115] Event: FeatureExtraction is taking too long, it took 111.199ms
2023/02/02 17:14:46.164 23610 23676 Error Unity AssertionException: Assertion failure. Values are equal.
2023/02/02 17:14:46.164 23610 23676 Error Unity Expected: 0 != 0
2023/02/02 17:14:46.164 23610 23676 Error Unity   at UnityEngine.Assertions.Assert.Fail (System.String message, System.String userMessage) [0x00000] in <00000000000000000000000000000000>:0 
2023/02/02 17:14:46.164 23610 23676 Error Unity   at UnityEngine.Assertions.Assert.AreNotEqual[T] (T expected, T actual, System.String message, System.Collections.Generic.IEqualityComparer`1[T] comparer) [0x00000] in <00000000000000000000000000000000>:0 
2023/02/02 17:14:46.164 23610 23676 Error Unity   at UnityEngine.XR.ARCore.ARCoreImageDatabase.Finalize () [0x00000] in <00000000000000000000000000000000>:0 
2023/02/02 17:14:46.164 23610 23676 Error Unity 
tdmowrer commented 1 year ago

@tdmowrer any update on this? The docs for AR Foundation 4.2 say's its possible to load an XR Reference Image Library via the asset bundle. When I try to download the library from cloud & load it in the editor, it works. Even the library has the image in it, however on Android Build i get these errors. Unity: 2021.3.0f1 AR Foundation: 4.2

2023/02/02 17:14:36.458 23610 23647 Error Unity InvalidOperationException: Failed to load XRReferenceImageLibrary 'UpdatedReferenceImageLibrary': library does not contain any ARCore data.
2023/02/02 17:14:36.458 23610 23647 Error Unity   at UnityEngine.XR.ARCore.ARCoreImageDatabase..ctor (UnityEngine.XR.ARSubsystems.XRReferenceImageLibrary serializedLibrary) [0x00000] in <00000000000000000000000000000000>:0 
2023/02/02 17:14:36.458 23610 23647 Error Unity   at UnityEngine.XR.ARCore.ARCoreImageTrackingSubsystem+ARCoreProvider.CreateRuntimeLibrary (UnityEngine.XR.ARSubsystems.XRReferenceImageLibrary serializedLibrary) [0x00000] in <00000000000000000000000000000000>:0 
2023/02/02 17:14:36.458 23610 23647 Error Unity   at UnityEngine.XR.ARSubsystems.XRImageTrackingSubsystem.CreateRuntimeLibrary (UnityEngine.XR.ARSubsystems.XRReferenceImageLibrary serializedLibrary) [0x00000] in <00000000000000000000000000000000>:0 
2023/02/02 17:14:36.458 23610 23647 Error Unity   at UnityEngine.XR.ARFoundation.ARTrackedImageManager.set_referenceLibrary (UnityEngine.XR.ARSubsystems.IReferenceImageLibrary value) [0x00000] in <00000000000000000000000000000000>:0 
2023/02/02 17:14:36.458 23610 23647 Error Unity   at PinaksARImageTracker+<ee>d__7.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
2023/02/02 17:14:36.458 23610 23647 Error Unity   at U
2023/02/02 17:14:36.480 23610 23759 Error native E0000 00:00:1675338276.480156   23759 motion_tracking_context.cc:1879] NOT_FOUND: Failed to find an image with the requested timestamp.
2023/02/02 17:14:36.480 23610 23759 Error native === Source Location Trace: ===
2023/02/02 17:14:36.480 23610 23759 Error native third_party/redwood/perception/feature_processing/image_buffer.cc:41
2023/02/02 17:14:36.480 23610 23759 Error native third_party/arcore/ar/perception/feature_track_ml_depth_provider.cc:168
2023/02/02 17:14:38.803 23610 23854 Info native I0000 00:00:1675338278.802925   23854 motion_analysis_calculator.cc:650] Analyzed frame 101
2023/02/02 17:14:42.530 23610 23854 Info native I0000 00:00:1675338282.530258   23854 motion_analysis_calculator.cc:650] Analyzed frame 201
2023/02/02 17:14:44.151 23610 23741 Info native I0000 00:00:1675338284.150964   23741 performance_monitor.cc:115] Event: FeatureExtraction is taking too long, it took 111.199ms
2023/02/02 17:14:46.164 23610 23676 Error Unity AssertionException: Assertion failure. Values are equal.
2023/02/02 17:14:46.164 23610 23676 Error Unity Expected: 0 != 0
2023/02/02 17:14:46.164 23610 23676 Error Unity   at UnityEngine.Assertions.Assert.Fail (System.String message, System.String userMessage) [0x00000] in <00000000000000000000000000000000>:0 
2023/02/02 17:14:46.164 23610 23676 Error Unity   at UnityEngine.Assertions.Assert.AreNotEqual[T] (T expected, T actual, System.String message, System.Collections.Generic.IEqualityComparer`1[T] comparer) [0x00000] in <00000000000000000000000000000000>:0 
2023/02/02 17:14:46.164 23610 23676 Error Unity   at UnityEngine.XR.ARCore.ARCoreImageDatabase.Finalize () [0x00000] in <00000000000000000000000000000000>:0 
2023/02/02 17:14:46.164 23610 23676 Error Unity 

I no longer work at Unity. This is a pretty old thread; I suggest you file a bug (not a GitHub issue).