首页 > 解决方案 > HoloLens 中的 QR 扫描 - DLL 错误

问题描述

我正在尝试从 HoloLens 中实现二维码阅读器,使用 Mike Taulty 的解决方案(https://mtaulty.com/2016/12/28/windows-10-uwp-qr-code-scanning-with-zxing-和-hololens/)。但是,我在 Unity 中构建项目时遇到问题,因为我收到构建错误:"Assets\Placeholder.cs(20,9): error CS0103: The name 'MediaFrameQrProcessing' does not exist in the current context",这似乎暗示 DLL 无法正常工作?我的项目中已经有一个同名的 DLL,我认为这个 DLL 可以解决这个问题,但似乎没有。

我正在运行 Unity 2018.4.1 和 Visual Studio 2019。我在他的 GitHub 存储库 ( https://github.com/mtaulty/QrCodes ) 之上构建。

这是引发构建错误的块。MediaFrameQrProcessing找不到

public void OnScan()
    {
        this.textMesh.text = "scanning for 30s";
        #if !UNITY_EDITOR
        MediaFrameQrProcessing.Wrappers.ZXingQrCodeScanner.ScanFirstCameraForQrCode(
            result =>
            {
                UnityEngine.WSA.Application.InvokeOnAppThread(() =>
            {
                  this.textMesh.text = result ?? "not found";
              },
            false);
            },
            TimeSpan.FromSeconds(30));
        #endif
    }

预期:没有事件的项目构建

实际结果:Assets\Placeholder.cs(20,9): error CS0103: The name 'MediaFrameQrProcessing' does not exist in the current context构建错误。这应该由 DLL 覆盖

导入设置截图:

DLL 导入设置

标签: c#unity3dqr-codehololens

解决方案


建议尝试用unity2017构建。我使用 unity2017.4.31f1 在存储库中构建了统一项目,它似乎工作正常。

更新:

我用2018.4.3新建了一个项目,做了一些简单的测试,使用这样的导入设置后没有抛出这个错误。

在此处输入图像描述


推荐阅读