【发布时间】:2019-08-21 15:50:14
【问题描述】:
我正在尝试从 HoloLens 中实现 QR 码阅读器,使用 Mike Taulty 的解决方案 (https://mtaulty.com/2016/12/28/windows-10-uwp-qr-code-scanning-with-zxing-and-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 放在
Plugins文件夹中?您是否已将 DLL 配置为针对此环境进行编译?你能贴一张DLL及其配置的图片吗 -
@LudovicFeltz 我添加了导入设置的图片
-
一切似乎都很好,但我不知道复选标记“不处理”是什么意思,而且我在文档中没有找到它...尝试取消选中它。我很确定问题出在这个配置的某个地方。也许看看documentation
-
在 Unity 2018.4 中,脚本后端默认设置为 IL2CPP。如果您没有将其更改为标记为过时并在 2019 年删除的 .NET,则构建不会考虑您的 DLL
标签: c# unity3d qr-code hololens