【问题标题】:Reference to type 'Matrix4x4' claims it is defined in 'System.Numerics', but it could not be found对“Matrix4x4”类型的引用声称它在“System.Numerics”中定义,但找不到
【发布时间】:2021-07-21 02:19:37
【问题描述】:

我正在为 Hololens 2 构建一个 Unity 项目,该项目使用来自 .NET 的库 System.Numerics

我按原样从 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。

【问题讨论】:

  • 你使用System.Numerics而不是Unity内置类型UnityEngine.Matrix4x4、UnityEngine.Vector3等有什么原因吗?
  • 实际上我以那个项目为例说明如何使用场景理解,我只是想让它按原样工作。如果我最终重写项目以适应我的需求,我会听取你的建议

标签: unity3d hololens


【解决方案1】:

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

构建设置 -> 播放器设置 -> 其他设置 -> Api Compatibility Level并选择.Net 4.x

【讨论】:

    猜你喜欢
    • 2018-11-23
    • 2018-09-12
    • 2018-10-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-07
    • 2012-08-19
    相关资源
    最近更新 更多