对类型“Matrix4x4”的引用声称它是在“System.Numerics”中定义的,但找不到

问题描述 投票:0回答:2

我正在为 Hololens 2 构建一个 Unity 项目,该项目使用来自

System.Numerics
 的库 
.NET

我按原样从 git 导入了这个项目,但我收到了几个类似于以下内容的错误:

System.Numerics.Matrix4x4 converted4x4LocationMatrix = ConvertRightHandedMatrix4x4ToLeftHanded(suObject.GetLocationAsMatrix());
error CS7069: Reference to type 'Matrix4x4' claims it is defined in 'System.Numerics', but it could not be found

System.Numerics
似乎也缺少
Vector3
Vector2
课程。

该项目已有几年历史,因此我使用的 Unity 版本可能需要更改配置中的某些内容,以使其与存在

Matrix4x4
的“System.Numerics”版本兼容。有谁知道如何解决这个问题吗?

我将

Unity 2019.2.4f1
Windows Build Support IL2CPP
一起使用。

unity-game-engine hololens mrtk
2个回答
5
投票

好吧,看来这个错误是由于项目中默认使用的.Net版本错误造成的。我不得不将其更改为4.x,步骤是:

构建设置 -> 播放器设置 -> 其他设置 -> Api 兼容性级别并选择.Net 4.x


0
投票

.NET框架也可以工作 (编辑 -> 项目设置 -> 播放器设置 -> API 兼容性级别)。

在 Unity 2022.3.6f1 上使用 MRTK 进行 UWP 构建测试,在使用 MRTK 功能工具箱中的场景感知功能时遇到此错误。

© www.soinside.com 2019 - 2024. All rights reserved.