Unity-Technologies / arfoundation-samples

Example content for Unity projects based on AR Foundation
Other
2.98k stars 1.11k forks source link

[Bug] Autofocus stops working on Android after ARSession.Reset() #1035

Closed Greken80 closed 1 year ago

Greken80 commented 1 year ago

Autofocus stops working after i have used Reset in SimpleAR scene. Seen the same issue in my projects after i use ARSession.Reset() and only experienced the issue on Android devices

Steps to reproduce the behavior:

  1. Build ARFoundation samples for Android
  2. Run Simple AR scene
  3. Press Reset button

After reset is complete the camera feed is blurry and unfocused. If Paus is pressed then Resume the autofocus starts working.

nextechar-hardik commented 1 year ago

I have also face this issue , but you can manually set Autofocus property once reset done that will resolve issue.

FindObjectOfType().autoFocusRequested = true;

andyb-unity commented 1 year ago

Hi all, thanks for the report. We have fixed this issue internally and will update this thread when we have version numbers for where the fix will land.

skaijiM commented 1 year ago

Hi all! I got same problem. ARCameraManager.autoFocusRequested = true; Not helping! Does anyone have a solution?

I have also face this issue , but you can manually set Autofocus property once reset done that will resolve issue.

FindObjectOfType().autoFocusRequested = true;

shb3014 commented 1 year ago

Same here, setting autoFocusRequested=true does not help.

Skaiji commented 1 year ago

Same here, setting autoFocusRequested=true does not help.

Hello! I see we are in the same boat :D

I'm trying to find a solution, if suddenly you manage to solve this problem, could you share the result? I will do the same if I can

Do you have telegram or something like that

andyb-unity commented 1 year ago

Hi all, you are unable to fix this issue on your end. As a temporary workaround you could consider de-initializing and re-initializing the XR Loader in your project instead of calling ARSession.Reset: https://github.com/Unity-Technologies/arfoundation-samples/blob/main/Assets/Scripts/Runtime/SceneUtility.cs

but this is not a recommended solution long-term. We will have a patch out in about two weeks with a fix for this.

Skaiji commented 1 year ago

Hi all, you are unable to fix this issue on your end. As a temporary workaround you could consider de-initializing and re-initializing the XR Loader in your project instead of calling ARSession.Reset: https://github.com/Unity-Technologies/arfoundation-samples/blob/main/Assets/Scripts/Runtime/SceneUtility.cs

but this is not a recommended solution long-term. We will have a patch out in about two weeks with a fix for this.

Yes! That helped! Thanks a lot.

But it seems that the image recognition time has increased, as if 3 times longer than it was before this script

DoppelG92 commented 1 year ago

Hi all, you are unable to fix this issue on your end. As a temporary workaround you could consider de-initializing and re-initializing the XR Loader in your project instead of calling ARSession.Reset: https://github.com/Unity-Technologies/arfoundation-samples/blob/main/Assets/Scripts/Runtime/SceneUtility.cs

but this is not a recommended solution long-term. We will have a patch out in about two weeks with a fix for this.

When I use

LoaderUtility.Deinitialize();
LoaderUtility.Initialize();

instead of ARSession.Reset(); The camera background is black and no tracking is starting. Am I missing something?

Finnalli commented 1 year ago

Hi all, you are unable to fix this issue on your end. As a temporary workaround you could consider de-initializing and re-initializing the XR Loader in your project instead of calling ARSession.Reset: https://github.com/Unity-Technologies/arfoundation-samples/blob/main/Assets/Scripts/Runtime/SceneUtility.cs

but this is not a recommended solution long-term. We will have a patch out in about two weeks with a fix for this.

Hi, any update on this?

andyb-unity commented 1 year ago

The fix is merged in on our side. We're kicking off a release soon and will post here when it's live. Release process takes a couple days to get through verification

andyb-unity commented 1 year ago

Thanks for everyone's patience during our release process.

This issue has been resolved in the following AR Foundation versions:

A fix for 5.1 will go live in 5.1.0-pre.5 along with several new features in the coming weeks.

As always when upgrading AR Foundation versions, make sure that you upgrade ALL AR Foundation-related packages to the same version:

Please upgrade to the latest patch of your choice and let us know how it goes.

DoppelG92 commented 1 year ago

Thank you. I can confirm, that the bug is fixed. :)

andyb-unity commented 1 year ago

Closing this issue as fixed. Feel free to re-open it if you discover any issues with the patch.

chandroidx commented 12 months ago

When I export and merge into Android project after upgrade to 5.0.6 , �Error has been discovered that did not exist in verison 4.2.8.

EntryPointNotFoundException: Unable to find an entry point named 'UnityARCore_pointCloud_Create' in 'UnityARCore'. Tried the following entry points: Unable to get function 'UnityARCore_pointCloud_Create' because of 'The requested function was not found (0x06000001) dlerror() = undefined symbol: UnityARCore_pointCloud_Create at UnityEngine.XR.ARCore.ARCoreXRPointCloudSubsystem+ARCoreProvider.UnityARCore_pointCloud_Create (System.Func1[TResult] guidGenerator) [0x00000] in <00000000000000000000000000000000>:0 at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.SubsystemsImplementation.SubsystemDescriptorWithProvider2[TSubsystem,TProvider].CreateProvider () [0x00000] in <00000000000000000000000000000000>:0 at UnityEngine.SubsystemsImplementation.SubsystemDescriptorWithProvider`2[TSubsystem,TProvider].Create () [0x00000] in <000000000000000000000000000

andyb-unity commented 12 months ago

Hi @chandroidx,

EntryPointNotFoundExceptions are usually the result of a mismatch in version numbers. Please ensure that your version numbers are identical for both AR Foundation (com.unity.xr.arfoundation) and the Google ARCore XR Plug-in (com.unity.xr.arcore).