Unity-Technologies / arfoundation-samples

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

Black Screen #2

Closed nems808 closed 4 years ago

nems808 commented 6 years ago

Unity 2018.1.5f I have built and ran the demo scene with a cube successfully before. Now, the build is only showing a black screen and the camera permission is never raised when starting the build for the first time. Does anyone have any ideas what might have changed?

Using Pixel XL, ARCore 1.3.180604066

beachgrub commented 6 years ago

I have run into related problem where I have setup with ARCore preview 17 and foundation preview 13. I have also tried latest. If we export directly the APK, we get all the correct permissions. but our build machine does an Android Gradle build and it ends up with black screen. This is because it is missing several permissions in manifest: "uses-permission android:name="android.permission.CAMERA" />

uses-feature android:name="android.hardware.camera.ar" android:required="true" / meta-data android:name="com.google.ar.core" android:value="required" /"

I notice in the log we get an error about Manifest on gradle build:

DirectoryNotFoundException: Could not find a part of the path "..\UnityProject\Builds\GeneratedApkTemp\src\main\AndroidManifest.xml". System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32

This is because it is missing the project name in the path. It should be GeneratedApkTemp/PROJECTNAME/src.

This looks like the problem file: UnityEditor.XR.ARCore.ARCoreManifest.OnPostGenerateGradleAndroidProject or before that.

beachgrub commented 6 years ago

I found the issue. It is a bug in the ARCoreBuildProcessor.cs https://github.com/Unity-Technologies/arfoundation-samples/issues/50

jelmer3000 commented 6 years ago

I have the same issue. ARFoundation preview19 ARCore preview 21 on a Samsung S8.

ade-adisa commented 6 years ago

Here's the fix, Just go to Edit > Project Settings > Player > XR Settings > Check 'ARCore Supported'.

tdmowrer commented 6 years ago

Here's the fix, Just go to Edit > Project Settings > Player > XR Settings > Check 'ARCore Supported'.

Please do not do that. That will break the com.unity.xr.arcore package. That is an older setting to support Google's ARCore Plugin.

This is a bug with the paths that Unity reports during certain types of builds. It is fixed in 2018.3.0a7.

ade-adisa commented 6 years ago

Here's the fix, Just go to Edit > Project Settings > Player > XR Settings > Check 'ARCore Supported'.

Please do not do that. That will break the com.unity.xr.arcore package. That is an older setting to support Google's ARCore Plugin.

This is a bug with the paths that Unity reports during certain types of builds. It is fixed in 2018.3.0a7.

Not True. It works perfect. My suggestion is Google's position as at September 27, 2018. https://developers.google.com/ar/develop/unity/quickstart-android

tdmowrer commented 6 years ago

@adisain Are you using Google's ARCore plugin for Unity? That is different from the one being discussed here (the package provided by Unity, available through Window > Package Manager). There is a check in this package that explicitly prevents you from building the Player if you check "ARCore Supported".

weblings commented 5 years ago

I found removing ARCore from the Package Manager and then adding it back made the built app ask me for camera permissions suddenly. Hopefully that works for anyone else having this issue

vitcozzolino commented 5 years ago

I have the same problem with Unity version 2018.3 and Google Pixel. I have a scene with just AR Session and AR Session Origin, build and run without issues but the screen stays black and the app never asks for permission to access the camera.

I checked the generated manifest and indeed there is nothing about camera permissions. If I run the Google ARCore examples, everything works fine.

prayash commented 5 years ago

Make sure that when Unity is exporting the .apk, your Android sdk folder has the version that it needs. I kept getting the black screen because of what seemed like tooling mismatch. Once I deleted the old ones that it was conflicting it, I kept the 28.0.3 folder only and then exported my as an APK. It finally worked after hours of struggling.

woelfle2004 commented 5 years ago

The guys who are experiencing problems, that the app never ask for camera permission should check if they have the file "unityandroidpermissions.aar" in their Unity Project Folder. For some reason this file can be lost. Go to a working Project Folder, copy that aar-file into your Project folder path and then the app should ask for camera permission.

watermelon-xi commented 5 years ago

Whatever I do, it's always going to be black screen on my device, and there's no error, is it because my machine is not on the list of devices that ARCore supports?

derekdominoes commented 5 years ago

woelfle2004 - thank you very much. This fixed the problem for me also. Not sure if it is a Google or Unity issues. But it would be great if either could check into why this file isn't get included. I was using Unity 2019.1.02f following the exact steps described https://developers.google.com/ar/develop/unity/quickstart-android

demanzonderjas commented 5 years ago

Using the ARkit/ARcore setup from the package manager instead of Unity ARkit latest package / Google's version, solved the issue for me

chillywilson commented 5 years ago

After updating unity I ran into this issue on my brand new samsung tab s4.

Removing and reinstalling all the ARcore/foundation/kit packages and remaking the ar session and ar session origin worked form me.

pravinanimataar commented 5 years ago

For those, who face Black Screen problem in Google VR and LWRP in unity 2019. Following thing worked for me.

  1. I used HelloVR Scene from Google VR SDK in untiy
  2. In Hierarchy, delete or disable GvrInstantPreviewMain GameObject. thats all.
JVNightRider commented 5 years ago

Hello, I have the same black screen problem using

When I compile using Scripting Backend 'Mono' it works perfectly, but when I change Scripting Backend to 'IL2CPP' and Target Architectures 'ARMv7' & 'ARM64', ARCore seems not working and Camera zone is a black screen. Can somebody help me?

Thanks!

zbagley commented 5 years ago

Was running into this issue myself, and closing the app and reopening (but not rebuild or resintalling) fixed this. No clue why the first build/install runs into the black screen.

AlexanderKub commented 5 years ago

Hello, I facing with strange black screen issue with ARCore supported Samsung devices, for example Galaxy S9.

In project I use:

On application startup tracking, and camera feed work fine, but after loading new content scene(with DontDestroyOnLoad(); on AR related gameobjects) black screen appear when camera facing loaded content, but tracking still work and black screen disappear when content move out from camera. Same issue possibly appearing on Huawei P20, but I haven't possible to test personally. On others vendors devices and on iOS this method work fine.

After I change content loading workflow to prefabs instantiate, this issue move out, but not for all content, for example issue still exist for objects how i think with transparent particles system. In my opinion this LWRP related issue, but i haven't more possibility for testing. I don't familiar with Samsung devices graphics unusual features what could affect on work in this way.

Maybe did someone facing this same problems? Or anyone have ideas how to find the reasons of this behaviour? I will be glad yours advices.

MarioUnity commented 5 years ago

Can you give us the model number of the S9 device you are using?

AlexanderKub commented 5 years ago

I did not correctly indicate the model, it’s S10, not S9. Model number Sm-g973f.

tdmowrer commented 5 years ago

@AlexanderKub I think you might be seeing a couple of issues:

  1. We don't have great LWRP support at the moment. Support will be more robust in a coming release.
  2. There is a known issue associated with scene switching. That will also be fixed shortly.
AlexanderKub commented 5 years ago

Thanks for the answer, then we will wait for updates.

cparki3 commented 5 years ago

I have been messing with a direct clone of this project for a couple of days now with a Galaxy S10+ and I either end up with an instant crash or black screen. I have camera permissions on and I can build within one scene that links to other scenes. The second I try to access any AR scene, the app crashes.

MarioUnity commented 5 years ago

@cparki3 Could you provide me with the model # of your Galaxy S10+? We are currently investigating an issue with the S10e, and will look into the S10+.

Morgan-6Freedom commented 5 years ago

👍 Working with

cparki77 commented 5 years ago

@MarioUnity Sorry for the delay! My model # is SM-G975U I'm also going to try the latest samples in a fresh clone this weekend to see if it may have been resolved since then.

macklinb commented 5 years ago

Probably not relevant to all, but I was getting a black screen with the following setup:

And the following printed in logcat, with no other errors or messages:

OPENGL NATIVE PLUG-IN ERROR: GL_INVALID_ENUM: enum argument out of range

After trying everything I could, the only thing that managed to solve it was to update the device from Android 7 to 8. What's strange is that vanilla ARCore (i.e. without AR Foundation) worked perfectly fine in Nougat - and is officially supported, but AR Foundation + ARCore XR Plugin did not. I'd be interested to know if anyone else has experienced the same thing.

zoidberg67 commented 5 years ago

I'm also getting an issue with a blank screen on first run using il2cpp -Unity 2019.2.11f1 but had the issue with 2.10 as well -Samsung S8 After hitting allow when I get the prompt for camera access the following shows in the logcat

"11/05 09:38:51.893 5227 5227 Error Unity: Exception: No such proxy method: UnityEngine.XR.ARCore.ARCorePermissionManager.OnPermissionGranted(System.String)"

followed by two blank errors and

"11/05 09:38:51.893 5227 5227 Error Unity: (Filename: currently not available on il2cpp Line: -1)"

then one final blank error

macklinb commented 5 years ago

@zoidberg67 That looks similar to another issue I had that turned out to be related to code stripping on IL2CPP (see here).

As mentioned in that topic, you can forcibly include the entire Unity.XR.ARCore assembly by creating a link.xml in the Assets folder with the following contents:

<linker>
    <assembly fullname="Unity.XR.ARCore" ignoreIfMissing="1" preserve="all"/>
</linker

Unsure if this will also work for you, but it's worth a shot.

zoidberg67 commented 5 years ago

Thanks macklinb that seems to have sorted it!

ar4ds commented 4 years ago

Mark, same problem on iPhoneMax, i've used official LWRP material (Packages>ARKit XR Plugin>Asset>Shaders>ARKitLWRPBackground.shader)Shader in "ARCameraBackground" Component, but background still black, should i add some texture to this material manually?

rehanpunjwani commented 4 years ago

I am facing the same problem. I made the app using the instructions from the coursera course and everytime App crashes or shows black screen after asking for permission. I am using Galaxy A6 plus and Unity 2019.2.

mdurand42 commented 4 years ago

This issue has become a catch-all for a variety of topics/issues. Closing. Please create new issues as needed.

regalstreak commented 4 years ago

Wanna leave this here, I had forgotten to add an AR Session which caused the black screen.

arthurvolpb commented 4 years ago

I finally got it working. I was having the black screen issue when building to iOS.

I followed this tutorial: https://www.youtube.com/watch?v=eu_eG0eTFlA

Using older versions of ARFoundation and ARKit seems to do the trick. Also, make sure you fill that "Camera Usage Description" mentioned above.

There is also a tutorial for Android

Parmeet349 commented 4 years ago

I am getting black screen in my Poco F1 I have installed ARFoundation ARCore Form the package manager Also unchecked the AR Support from the player settings

hamza-alsawy commented 4 years ago

i made a small GPS AR application .. no error appears when i Run the application but with a black screen from the AR camera. However, when i build the application errors show up for the AR Core Plugin.

BuildFailedException: "ARCore Supported" (Player Settings > XR Settings) refers to the built-in ARCore support in Unity and conflicts with the "ARCore XR Plugin" package. UnityEditor.XR.ARCore.ARCorePreprocessBuild.EnsureARCoreSupportedIsNotChecked () (at Library/PackageCache/com.unity.xr.arcore@2.1.8/Editor/ARCoreBuildProcessor.cs:59) UnityEditor.XR.ARCore.ARCorePreprocessBuild.OnPreprocessBuild

bild error ARcore optional XR

rstecca commented 4 years ago

In case you fellows stumble upon this with Unity 2019.4.x what worked for me was to

disable Project Settings > Player > XR Settings > ARCore Supported and
enable Project Settings > XR Plugin Management > Plug-in Providers : ARCore

2020-10-05 16_38_28-TopTalTestB - SampleScene - Android - Unity 2019 4 6f1 Personal  PREVIEW PACKAGE 2020-10-05 16_38_56-TopTalTestB - SampleScene - Android - Unity 2019 4 6f1 Personal  PREVIEW PACKAGE

ahmedaniss25 commented 3 years ago

Problem fixed here : https://youtu.be/c6Zbqm5Fys8

2905Yatharth commented 1 year ago

I'm gonna guess it's the same issue. Did you try adding a Camera Usage Description? It's required when building out of Xcode (iOS) and I'm assuming it's the same case for Android.

Edit > Project Settings > Player > Other Settings > Camera Usage Description.

You can write in any random text.

what to do in the case of Android Phone ?

tdmowrer commented 1 year ago

@2905Yatharth Black screen just means "something didn't work" and is a symptom with many possible causes. I suggest you open a new issue with specific steps taken, device model, SDK versions, etc. rather than add to this (now very old) thread.