KageKirin.Unity.Mathematics 1.3.2

dotnet add package KageKirin.Unity.Mathematics --version 1.3.2                
NuGet\Install-Package KageKirin.Unity.Mathematics -Version 1.3.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="KageKirin.Unity.Mathematics" Version="1.3.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add KageKirin.Unity.Mathematics --version 1.3.2                
#r "nuget: KageKirin.Unity.Mathematics, 1.3.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install KageKirin.Unity.Mathematics as a Cake Addin
#addin nuget:?package=KageKirin.Unity.Mathematics&version=1.3.2

// Install KageKirin.Unity.Mathematics as a Cake Tool
#tool nuget:?package=KageKirin.Unity.Mathematics&version=1.3.2                

Unity.Mathematics for NuGet

This repo consists of build scripts and .NET projects that work on the official Unity.Mathematics repo, or rather its unofficial mirror, to create NuGet packages that are deployed to the GitHub NuGet repository.

The intention is to make Unity.Mathematics usable by regular .NET classlibs (and thus NuGet packages) that could also be distributed as Unity packages containing precompiled assemblies.

tl;dr or I just want to fetch the correct dependency

Regular C# project (classlib or app)

<ItemGroup>
  <PackageReference Include="Unity.Mathematics.NoDeps" Version="1.3.2" PrivateAssets="All"/>
</ItemGroup>
dotnet add package Unity.Mathematics.NoDeps --version 1.3.2

Classlib distributed as Unity package and consumed by Unity only

<ItemGroup>
  <PackageReference Include="Unity.Mathematics" Version="1.3.2" PrivateAssets="All"/>
</ItemGroup>
dotnet add package Unity.Mathematics --version 1.3.2

Projects and NuGet packages

Unity.Mathematics

This project and NuGet package is the verbatim Unity.Mathematics package which has a dependency on the UnityEngine.dll.

As such, projects referencing this package might (untested atm) also require to provide a PathHint to the aforementioned assembly. (See below for more information about this process).

Unity.Mathematics.Editor

This project and NuGet package is the verbatim Unity.Mathematics.Editor package which has a dependency on both the UnityEngine.dll and the UnityEditor.dll.

As such, it is not recommended to reference this package by other classlibs.

In case classlibs still want to reference this package, they will also require to provide PathHints to the aforementioned assemblies. (See below for more information about this process).

Unity.Mathematics.NoDeps

This project and NuGet package is a slightly Unity.Mathematics package that does not have any dependency on UnityEngine.dll.

As such, it is the preferred dependency for regular .NET classlib and program projects.

In detail: there are 2 files causing the dependency on UnityEngine:

  • math_unity_conversion.cs implementing straight cast operators between UnityEngine types and Unity.Mathematics ones,
  • and PropertyAttributes.cs defining 2 attributes inheriting from UnityEngine.PropertyAttribute (Note that those attributes are not further reference in Unity.Mathematics itself, but by Unity.Mathematics.Editor).

Those 2 files are excluded from compilation through specific project settings.

Absent projects

Unity.Mathematics.Tests does not have an equivalent project as it is not required for regular compilation.

Referencing Unity assemblies through PathHint

  <ItemGroup Label="Unity">
    <Reference Include="UnityEngine">
      <HintPath>$(UNITY_ASSEMBLY_PATH)\UnityEngine.dll</HintPath>
    </Reference>
    <Reference Include="UnityEditor">
      <HintPath>$(UNITY_ASSEMBLY_PATH)\UnityEditor.dll</HintPath>
    </Reference>
  </ItemGroup>

with the environment variable UNITY_ASSEMBLY_PATH pointing to the directory containing the Unity Editor executable.

  • e.g. on macOS: C:\Program Files\Unity\Hub\Editor\2022.3.47f1\Editor\Data\Managed.
  • e.g. on Windows: /Applications/Unity/Hub/Editor/2022.3.47f1/Unity.app/Contents/Managed.
  • e.g. on Linux: $UNITY_INSTALL_PATH/Hub/Editor/2022.3.47f1/Editor/Data/Managed.

NuGettier et al

In case you are using NuGettier or similar tools to create Unity packages from your NuGet packages, please make sure to adequately configure them to neither recurse nor include the assemblies of Unity.Mathematics itself, but rather mark it as dependency.

For NuGettier, you need to add this to its global .netconfig:

[package "unity.mathematics.*"] # '.*' is to take in the regex sense, and lowercase is b/c no case sensitivity
name = "com.unity.mathematics"
version = "^(?<major>0|[1-9]\\d*)\\.(?<minor>0|[1-9]\\d*)\\.(?<patch>0|[1-9]\\d*)" #only keep major.minor.patch, drop the rest
ignore = false  #do not ignore, as in include-in-dependencies
exclude = true  #exclude, as in do-not-include into amalgamte packages
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on KageKirin.Unity.Mathematics:

Package Downloads
KageKirin.Unity.Mathematics.Editor

NuGet packed from Unity.Mathematics UPM package with a dependency on UnityEngine.dll and UnityEditor.dll

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.3.2 1,542 10/16/2024

CHANGELOG.md