Unity-Technologies / arfoundation-samples

Example content for Unity projects based on AR Foundation
Other
3.07k stars 1.15k forks source link

[Bug] Black screen on Samsung Galaxy A23 5G #1079

Closed dan-asa closed 11 months ago

dan-asa commented 1 year ago

Describe the bug Building app with SimpleAR scene from ARFoundation Samples 5.0/4.2 has black screen, but if I build with ARFoundation Samples 4.1 it works fine. This happens only on Samsung Galaxy A23 5G device, but can't reproduce on Samsung Galaxy Note 8. I have tried making Depth optional, but same behaviour and errors that repeats for each frame.

Android logcat saved from Unity editor using Logcat package https://pastebin.com/B2WVDm49

2023/04/24 15:13:48.845 4394 4635 Error RepeatCaptureReq(0) Capture failed. 2023/04/24 15:13:48.846 4394 4635 Error RepeatCaptureReq(0) Buffer lost for frame 0 2023/04/24 15:13:48.846 4394 4635 Error RepeatCaptureReq(0) Buffer lost for frame 0 2023/04/24 15:13:48.893 4394 4635 Error RepeatCaptureReq(0) Capture failed. 2023/04/24 15:13:48.894 4394 4750 Error StartedCameraController(0) Saw capture failed event, failure: android.hardware.camera2.CaptureFailure@9a3db68. 2023/04/24 15:13:48.903 4394 4635 Error RepeatCaptureReq(0) Capture failed. 2023/04/24 15:13:48.903 4394 4702 Error StartedCameraController(0) Saw capture failed event, failure: android.hardware.camera2.CaptureFailure@20e4b81. 2023/04/24 15:13:48.904 4394 4635 Error RepeatCaptureReq(0) Buffer lost for frame 1 2023/04/24 15:13:48.905 4394 4750 Error StartedCameraController(0) Saw buffer lost event for frame 1. 2023/04/24 15:13:48.906 4394 4635 Error RepeatCaptureReq(0) Buffer lost for frame 1 2023/04/24 15:13:48.906 4394 4702 Error StartedCameraController(0) Saw buffer lost event for frame 1.

To Reproduce Steps to reproduce the behavior: Build app with SimpleAR scene using 4.2 or 5.0 version

Expected behavior Camera feed and AR functionality should work

Actual behavior Black screen and errors in Android logcat

Smartphone:

andyb-unity commented 1 year ago

Hard to tell if this is an issue with Unity or with Samsung. Please file a bug: https://unity3d.com/unity/qa/bug-reporting

stale[bot] commented 1 year 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.

matejnevlud commented 1 year ago

I think it is related to this bug in arcore https://github.com/google-ar/arcore-android-sdk/issues/1553

PauGuillamon commented 1 year ago

Happy to see it also affects Unity 😄 But I'm surprised to see it worked fine with Unity 2020.3.23f1. Does anybody know what ARCore version was used there?

matejnevlud commented 1 year ago

@PauGuillamon It seems that it uses ARCore 1.22, original post mentions Unity 2020.3.23f1 with ARFoundation version 4.1. Documentation for ARFoundation 4.1 mentions ARCore 1.22 : https://docs.unity3d.com/Packages/com.unity.xr.arcore@4.1/manual/index.html

This version of ARCore XR Plugin uses ARCore 1.22 and supports the following functionality:

marcoslimeira commented 1 year ago

I am studing on the Unity Learning pathway, and with version 2021.3.1f1, the front camera of the A23 works, but the rear camera doesn't, even though the device indicates that ARCore is using it. By downgrading to AR Foundation 4.1, I managed to activate both cameras, using version 2020.3.41.f1. It's worth noting for new users like me, that it was necessary to install URP, configure a URP Asset, and include an AR Background Render Feature to your Asset_Renderer. Don't forget to link it to the Scriptable Render Pipeline Settings in Project Settings/Graphics.

yanadelrey commented 1 year ago

On Android 12 (API level 31) or later, make sure that "Block Camera" is set to OFF in system settings.

I randomly found it here in Errors section lol: https://developers.google.com/ar/design/interaction/ui

Tell me if it works. (btw I am a UX Designer)

andyb-unity commented 11 months ago

Closing this issue as OP's problem appears to be due to the ARCore bug linked in this thread.

There are many reasons why an AR app might render a black screen to device, and if you are experiencing this on anything other than a Samsung A23, please file a bug: https://unity3d.com/unity/qa/bug-reporting. You are welcome to open new issues as well, but filing a bug is the official way to report bugs. GitHub issues may not be seen by the development team.

FYI: a common Android black screen issue right now is that folks are using the "AR Feature" in package manager, which includes a Magic Leap package that seems to mess with Android apps. If this affects you, for now, do not use the AR Feature, and instead install your AR packages individually.