Unity ARFoundation无法找到ARCameraBackground

时间:2019-07-01 08:38:39

标签: c# android unity3d

我正在尝试使用Unity的AR Foundation软件包和ARCore来编译AR场景的android构建。

除了从我的移动设备上实际获取相机供稿,并且运行内置编辑器返回错误之外,所有其他操作均会出错:

NullReferenceException: Object reference not set to an instance of an object
UnityEngine.XR.ARFoundation.ARCameraBackground.OnDisable () (at Library/PackageCache/com.unity.xr.arfoundation@2.2.0-preview.2/Runtime/AR/ARCameraBackground.cs:192)

我调查了声称有错误的脚本,并且该错误似乎是由于以下原因引起的:

void OnEnable()
        {
            UpdateMaterial();
            m_CameraManager.frameReceived += OnCameraFrameReceived;
            ARSession.stateChanged += OnSessionStateChanged;
        }

我不确定该错误的出处是在摄像机本身之外,可能无法以某种方式找到材料来源?关闭此应用程序后,还会在此代码块中返回相同的错误:

void OnDisable()
        {
            mode = ARRenderMode.StandardBackground;
            m_CameraManager.frameReceived -= OnCameraFrameReceived;
            ARSession.stateChanged -= OnSessionStateChanged;
            m_CameraSetupThrewException = false;

            // We are no longer setting the projection matrix
            // so tell the camera to resume its normal projection
            // matrix calculations.
            m_Camera.ResetProjectionMatrix();
        }

我正在努力弄清为什么AR Foundation无法识别相机供稿的来源,并且我已经对这个问题进行了很多研究。尝试在设备上运行该设备时,它会要求获得摄像头许可,但是该Feed永远不会显示。

0 个答案:

没有答案