代码之家  ›  专栏  ›  技术社区  ›  Joseph Oliver

联合基金会找不到ARCameraBackground

  •  0
  • Joseph Oliver  · 技术社区  · 7 年前

    除了从我的移动设备实际获取摄像头提要外,其他一切都正常,运行内置编辑器会返回错误:

    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基金会不能确定摄像头的来源,我已经做了相当多的谷歌搜索到这个问题。当试图在设备上运行它时,它会请求摄像头的许可,但是提要从不显示。

    0 回复  |  直到 7 年前