Unity-Technologies / arfoundation-samples

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

[Bug] [IN-47250] Black screen with skipped rendering frame and error "GfxDevice is in invalid state (device lost)" when Player is built with ARCore #1091

Open camnewnham opened 11 months ago

camnewnham commented 11 months ago

Unity bug report case number [IN-47250]

Reproduction steps

  1. Open the attached project "ReproProj" with Android Platform
  2. Open the “/Assets/ExampleAssets/Scenes/SampleScene.unity” Scene
  3. Build And Run
  4. Observe the Player

or alternatively,

  1. Start a new AR sample project in 2024.3.4f1
  2. Add ARCore to the platform providers
  3. Build and run sample scene.

Expected result The screen shows a view from the back camera of the device

Actual result The screen is black

Reproducible with: 5.0.3 (2023.2.0a7), 5.1.0-pre.4 (2022.3.4f1, 2023.1.5f1, 2023.2.0a23), 5.1.0-pre.8 (2023.2.0a23) Could not test with: 5.0.2 (2023.1.0a22), 5.0.6 (2021.3.28f1) (An error occurred while resolving packages: Project has invalid dependencies: com.unity.feature.ar: Package [com.unity.feature.ar@1.0.1] cannot be found)

Reproducible with devices: VLNQA00318, Oneplus OnePlus 7 Pro (GM1913), Android 11, CPU: Snapdragon 855 SM8150, GPU: Adreno (TM) 640 VLNQA00231, Samsung Galaxy A5(2017) (SM-A520F), Android 8.0.0, CPU: Exynos 7 Octa 7880, GPU: Mali-T830 VLNQA00494 - iPhone 14 Pro Max, 16.3.1 iOS VLNQA00358 - iPhone 12, 14.1 iOS VLNQA00392 - iPad (9th generation), 15.0 iOS VLNQA00310 - iPad Pro 12.9", 13.4.1 iOS

Not reproducible with devices: VLNQA00231, Huawei HUAWEI Mate 20 Pro (LYA-L29), Android 9, CPU: HiSilicon Kirin 980, GPU: Mali-G76 VLNQA00325, Samsung Galaxy Note10 (SM-N970F), Android 12, CPU: Exynos 9 (9825), GPU: Mali-G76

Testing environment: Windows 10 Enterprise 21H2

Notes:

victorteokw commented 11 months ago

This issue exists with 2023.1.0f1 especially on Android devices

Weimmer commented 11 months ago

Try lock and unlock the screen when you get the black screen, it works for me for now, need to be fixed anyway.

SantaSqualala commented 11 months ago

This issue still exists as of Unity 2022.3.6f1

Steps to reproduce

  1. Port a project from 2021.3.20f1 to 2022.3.6f1
  2. Make sure that project is using ARCore, every ARFoundation plugin is installed and project targeted to Android devices
  3. Build and Run with device connected to the pc and set as Target Device
  4. Observe Android Logcat and device screen

Result Black screen and Logcat reporting the error message each frame

Reproduced on this device : SMT725, SAMSUNG Galaxy Tab S5e, Android 11, OneUI 3.1

camnewnham commented 11 months ago

This issue is tracked here: https://issuetracker.unity3d.com/issues/android-black-screen-with-skipped-rendering-frame-and-error-gfxdevice-is-in-invalid-state-device-lost-when-player-is-built-with-google-arcore

surlabo commented 8 months ago

Dont create a project from the Unity AR template, just create a regular 3D project and import assets one by one, everything magically works. the hard part is you should know how to set everything from a clean page

andyb-unity commented 5 months ago

Hi all, our investigation has shown that this issue is caused by the Magic Leap package being present in the project. The workaround to fix this is:

This workaround has worked for everyone so far. We have this issue assigned to the Magic Leap team for further investigation as well. Please share if you have any different experiences, otherwise we'll close this issue as it's a Magic Leap issue, not AR Foundation.

MohxGames commented 3 months ago

Hello, I recently ran into this problem and haven't had it remedied by removing the Magic Leap plugin.

When the Magic Leap plugin is in-app, it launches to a black screen nearly every time. If I remove it, the first build works fine every time until the application is unfocused or restarted, at which point it will likely go to the black screen. It occasionally turns it on, but I cannot find a consistent way to make it do this.

Were there any additional required steps to make this work besides just removing the Magic Leap plugin? Project was built in 2023.2.14 with ARFoundation 5.1.3 (AR Template)

andyb-unity commented 3 months ago

Per the instructions above, you must also close Unity and delete your Library folder