unity-game-enginehololensmrtk

Reference to type 'Matrix4x4' claims it is defined in 'System.Numerics', but it could not be found


I am building a Unity project for Hololens 2 which is using the library System.Numerics from .NET

I imported this project from git as is, but I am getting several errors similar to:

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 seems to be missing as well Vector3 and Vector2 classes.

The project is a few years old, so probably the version of Unity which I am using needs to change something in the configuration to make it compatible with a 'System.Numerics' version where Matrix4x4 would be present. Does anyone know how to fix this?

I am using Unity 2019.2.4f1 with Windows Build Support IL2CPP.


Solution

  • Ok, it seems the error was due to the .Net version used in the project by default was the wrong one. I had to change it to 4.x, the steps were:

    Build Settings -> Player Settings -> Other Settings -> Api Compatibility Level and select .Net 4.x