Problem with instant preview

I’m not sure what is happening suddenly I lost possibility of using instant preview. When I click “play” i see white screen instead of preview from camera and when I pause it in the console I see

NullReferenceException: Object reference not set to an instance of an object
UnityEngine.XR.ARBackgroundRenderer.DisableARBackgroundRendering () (at C:/buildslave/unity/build/Runtime/AR/ScriptBindings/ARBackgroundRenderer.cs:172)
UnityEngine.XR.ARBackgroundRenderer.set_mode (ARRenderMode value) (at C:/buildslave/unity/build/Runtime/AR/ScriptBindings/ARBackgroundRenderer.cs:109)
GoogleARCore.ARCoreBackgroundRenderer.Disable () (at Assets/GoogleARCore/SDK/Scripts/ARCoreBackgroundRenderer.cs:103)
GoogleARCore.ARCoreBackgroundRenderer.OnDisable () (at Assets/GoogleARCore/SDK/Scripts/ARCoreBackgroundRenderer.cs:66)

Any ideas? Everything is in latest version

1 Like

I got the same problem when i switch to another project using ARCore and instant preview. Everything works fine until i switch a project. Instant preview turns white and don’t connect with editor anymore.

Same here on S8, Win10, Unity 2017.4.1f1. Apparently

Texture backgroundTexture = Frame.CameraImage.Texture;

is null. Any ideas how to solve this?

Instant preview not working on MacBook Pro + S8

Thanks, I added my spec. Using Win10.

I believe that only one instance of Unity running instant preview at a time is allowed. So if you had one instance up and running close it before trying another…

check the troubleshooting section

Already did, doesn’t solve the issue. Apparently more people have that problem:

Try adding these lines to your code :

#if UNITY_EDITOR
    // Set up touch input propagation while using Instant Preview in the editor.
    using Input = InstantPreviewInput;
#endif

It causes the null reference error to not crash the app. It just logs the error after quitting the app.

These lines are already in the HelloARController class of the GoogleARCore example unitypackage. Doesn’t work.

It seems like as of now it is a bug, they said it will be fixed in an upcoming release.

Who said that? Unity or Google?

I got the same problem when running HelloAR with instant preview on my Samsung Galaxy S8 (SM G950F, Android 8.0.0). Run on MacBook with Unity 2018.1.0f2 and ARCore 1.2.

Screen shot when I run directly by touching the App’s icon, not by instant preview.

same problem here, but no error message, just a white screen

same here, galaxy s9 running android 8.0.0, unity 2018.1.0f2, arcore 1.2.0, and instant preview 1.0.8

I just found the reason of my case. Unity ARKit plugin affected some settings (I don’t know what setting) and made issues for AR Core. If you run AR Core and ARKit in separate project, you will avoid that problem.

no one have a solution?
i am stuck :frowning:

This is critical for the development, anyone has a workaround for this?

Bump… Seems like this is a pretty widespread issue