Black screen in Unity 2022 play mode

Hi all,

Using Unity 2022.3.2f1 with Universal AR 3.1.0 with URP, I was getting a black screen and no tracking when running in the Editor. I got the following error in the console:

d3d11: failed to create 2D texture shader resource view id=196 [D3D error was 80070057]

After some searching online, I found people getting a similar error when creating a Unity Texture2D under URP and passing “false” for the linear parameter, and resolving it by passing “true” instead.

On line 656 of Z.cs there is the following call:
texture = Texture2D.CreateExternalTexture(4, 4, TextureFormat.ARGB32, false, false, ptr);

changing the linear parameter here to true:
texture = Texture2D.CreateExternalTexture(4, 4, TextureFormat.ARGB32, false, true, ptr);

fixes the problem, and the camera feed works properly in play mode, as well as in a webAR build.

Posting this in case it’s useful for anyone else.

General troubleshooting steps that might help if you encounter a black screen issue in Unity’s play mode.

  1. Check Camera Settings: Ensure that your camera is set up correctly. Check the camera’s position, rotation, and field of view settings to make sure it is capturing the scene as intended.
  2. Verify Scene Setup: Double-check your scene setup. Ensure that all necessary objects and components are present and correctly placed.
  3. Check for Errors: Look for any error messages or warnings in the Unity Console window. Errors could provide valuable insights into what might be causing the black screen issue.
  4. Update Graphics Drivers: Make sure you have the latest graphics drivers installed for your GPU. Outdated drivers can sometimes cause display issues in Unity.
  5. Reset Unity Preferences: Occasionally, preferences or settings in Unity can become corrupted, leading to unexpected behavior. You can try resetting Unity preferences to their default values by going to “Edit” → “Preferences” → “General” → “Reset all to default.”
  6. Test on Different Platforms: If you are running the project on a specific platform, try running it on another platform (e.g., switch from Windows to Android Vidmate app or vice versa) to see if the issue persists. This can help isolate platform-specific problems.
  7. Disable Plugins or Extensions: If you are using third-party plugins or extensions, try disabling them one by one to see if any of them are causing the issue.
  8. Reinstall Unity: If none of the above steps resolve the problem, consider reinstalling Unity to ensure a clean installation.

Remember to keep regular backups of your Unity projects to avoid any potential data loss during troubleshooting.

If you are experiencing the black screen issue in a version of Unity beyond 2021, I recommend checking the Unity forums, official documentation, or reaching out to Unity support for the most up-to-date information and assistance. Community forums can be an excellent resource for troubleshooting issues specific to particular versions of Unity.

Thanks @roarmot

It seems from 2022 LTS Unity is using Linear Color space as default on PC, which used to be Gamma in earlier versions. So passing respective linear flag value in Texture2D.CreateExternalTexture method makes sense and seems to fix the black screen issue. Alternatively, one can also switch to Gamma Color space from Unity editor till we fix this more generally.

I am yet to fully to test our SDK on 2022LTS so will update this thread once the new changes are live.


1 Like

I just wanted to say thank you, this answer saved me from hours of headache!

1 Like