This project provides a seamlessly integration of a curated list of NuGet packages within the Unity Package Manager.
DISCLAIMER: This is not an official service provided by Unity Technologies Inc.
In order to use this service you simply need to edit the Packages/manifest.json
in your project and add the following scoped registry:
{
"scopedRegistries": [
{
"name": "Unity NuGet",
"url": "https://unitynuget-registry.azurewebsites.net",
"scopes": [
"org.nuget"
]
}
],
"dependencies": {
"org.nuget.scriban": "2.1.0"
}
}
WARNING: If you are encountering weird compilation errors with UnityNuGet and you have been using UnityNuGet already, it could be that we have updated packages on the server, and in that case, you need to clear the cache containing all Unity NPM packages downdloaded from the
unitynuget-registry.azurewebsites.net
registry. On Windows, this cache is located at:%localappdata%\Unity\cache\npm\unitynuget-registry.azurewebsites.net
When opening the Package Manager Window, you should see a few packages coming from NuGet (with the postfix text (NuGet)
)
This service provides only a curated list of NuGet packages
Your NuGet package needs to respect a few constraints in order to be listed in the curated list:
- It must have non-preview versions (e.g
1.0.0
but not1.0.0-preview.1
) - It must provide
.NETStandard2.0
assemblies as part of its package
You can send a PR to this repository to modify the registry.json file (don't forget to maintain the alphabetical order)
I recommend also to specify the lowest version of your package that has support for .NETStandard2.0
upward so that other packages depending on your package have a chance to work with.
Beware that all transitive dependencies of the package must be explicitly listed in the registry as well.
NOTE:
- We reserve the right to decline a package to be available through this service
- The server will be updated only when a new version tag is pushed on the main branch.
Only compatible with Unity 2019.1
and potentially with newer version.
NOTE: This service is currently only tested with
Unity 2019.x, 2020.x and 2021.x
It may not work with a more recent version of Unity
Example of a basic docker-compose.yml file:
services:
unitynuget:
build: .
ports:
- 5000:80
volumes:
- ./unity_packages:/app/unity_packages
There is a complete example in examples/docker.
As documented in the example, it is possible to provide a custom NuGet.Config file.
To add a private feed, the following fields must be filled in.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="MyCustomFeed" value="https://pkgs.dev.azure.com/<ORG_NAME>/<PROJECT_NAME>/_packaging/<FEED_NAME>/nuget/v3/index.json" />
</packageSources>
<packageSourceCredentials>
<MyCustomFeed>
<add key="Username" value="<Azure DevOps Email>" />
<add key="ClearTextPassword" value="<Azure DevOps PAT>" />
</MyCustomFeed>
</packageSourceCredentials>
</configuration>
Note: The Azure DevOps PAT must have Packaging (Read) permissions.
On Azure through my own Azure credits coming from my MVP subscription, enjoy!
The reason is that many NuGet packages are not compatible with Unity, or do not provide .NETStandard2.0 assemblies or are not relevant for being used within Unity.
Also currently the Package Manager doesn't provide a way to filter easily packages, so the UI is currently not adequate to list lots of packages.
Since 2019.1, Unity is now compatible with .NETStandard2.0
and it is the .NET profile that is preferred to be used
Having a .NETStandard2.0
for NuGet packages for Unity can ensure that the experience to add a package to your project is consistent and well supported.
This project implements a simplified compatible NPM server in C# using ASP.NET Core and converts NuGet packages to Unity packages before serving them.
Every 10min, packages are updated from NuGet so that if a new version is published, from the curated list of NuGet packages, it will be available through this service.
Once converted, these packages are cached on the disk on the server.
This software is released under the BSD-Clause 2 license.
Alexandre Mutel aka xoofx