首页 > 解决方案 > 对“Matrix4x4”类型的引用声称它在“System.Numerics”中定义,但找不到

问题描述

我正在为 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似乎也不见了,还有Vector3Vector2

该项目已有几年历史,因此我使用的 Unity 版本可能需要更改配置中的某些内容,以使其与将出现的“System.Numerics”版本兼容Matrix4x4。有谁知道如何解决这一问题?

我正在Unity 2019.2.4f1使用Windows Build Support IL2CPP.

标签: unity3dhololens

解决方案


好的,似乎错误是由于项目中默认使用的.Net版本是错误的。我不得不将其更改为 4.x,步骤如下:

Build Settings -> Player Settings -> Other Settings -> Api Compatibility Level并选择.Net 4.x


推荐阅读