NuGet Packages
Introduction to the UnityNuGet Project
NuGet is the package manager for .NET, designed to enable developers to share fundamental reusable code. As you may know, Unity uses its own package manager format (UPM). Traditionally, to use a NuGet package in Unity, UPM packages include the NuGet package as embedded DLLs. This approach can become problematic when two packages include the same DLL or different versions of a NuGet package. A robust solution is to create a shared NuGet package in UPM format that other packages can depend on.
Alexandre Mutel (xoofx) originally created the UnityNuGet project, which is now maintained by Borja DomÃnguez (bdovaz). This service converts NuGet packages to UPM format. The UnityNuGet registry server handles the packaging of these NuGet packages in a consistent and automated way, using proper naming under the org.nuget scope.
OpenUPM hosts a UnityNuGet server at https://unitynuget-registry.openupm.com. The service tracks the latest Docker release version and automatically deploys updates when a new version is released.
If you wish to update the tracked NuGet packages, please follow the instructions in the UnityNuGet documentation.
Using Uplinked UnityNuGet
Experiments
The UnityNuGet uplink is an experimental feature.
To improve convenience, the OpenUPM registry uplinks to the UnityNuGet registry, making it transparent for Unity users to consume UnityNuGet packages.
- The OpenUPM registry synchronizes with the UnityNuGet registry on an hourly basis.
- Package tarballs are hosted on our CDN server, ensuring fast access.
- You can view package details via
https://package.openupm.com/org.nuget.some-packageor by using the openupm-cli commandopenupm view org.nuget.some-package. - You can search
org.nugetpackages through the OpenUPM registry search endpoint, openupm-cli search, and the Unity Package Manager search interface.
The integration comes with a few limitations:
- NuGet packages have generated website pages based on the UnityNuGet curated package list. They can appear in website search results as a separate UnityNuGet package group, but they are not included in the normal filterable OpenUPM package list.
- Package page details and search results are served by the registry uplink and may depend on UnityNuGet availability and cache freshness. If UnityNuGet is temporarily unavailable, already cached package metadata and tarballs continue to resolve through OpenUPM, but new uncached package details and search results may be delayed until the uplink recovers.
To demonstrate the uplinks feature, we have created a staging package at https://github.com/openupm/com.example.nuget-consumer which includes:
- Installation of an OpenUPM package that depends on UnityNuGet.
- Resolution of potential assembly conflicts by disabling "Assembly Version Validation."
If you install a package via openupm-cli, the uplink is used by default— all packages under the org.nuget scope are resolved directly from the OpenUPM registry.
If Unity cannot find an org.nuget package after you add it to the manifest, check the org.nuget scope and registry entry with Unity Scoped Registry Troubleshooting.
Using UnityNuGet Directly
In general, we recommend using the uplink feature to take advantage of the CDN and openupm-cli. If you prefer to query UnityNuGet directly, you can add the UnityNuGet registry as a scoped registry in your manifest.json:
{
"scopedRegistries": [
{
"name": "Unity NuGet",
"url": "https://unitynuget-registry.openupm.com",
"scopes": [
"org.nuget"
]
},
// ... (other scoped registries, for example the OpenUPM registry)
]
}
List All UnityNuGet Packages
You can browse the curated list of UnityNuGet packages on the UnityNuGet GitHub repository.