(adsbygoogle = window.adsbygoogle || []).push({});

OpenUPM Uplinks to the UnityNuGet Registry

2021-05-04 · Favo Yang · 2 min read

Originally published on Medium

NuGetopen in new window is the package manager for .NET, designed to enable developers to share fundamental reusable code. Many UPM packages use NuGet packages as embed DLLs. The practice gets troubled when two packages included the same DLL or different versions of one NuGet package. It’s a frequently asked question in the OpenUPM discussionopen in new window and the Unity forum.

The solution is to create a shared NuGet package in the UPM format that everyone can depend on.

Thanks to xoofxopen in new window’s UnityNuGetopen in new window which is a project that provides a service to bundle NuGet packages into the UPM format. Similar to OpenUPM, UnityNuGet maintains a curated listopen in new window of NuGet packages. All packages list there should be available on a registry at https://unitynuget-registry.azurewebsites.net.open in new window The NuGet Registry takes care of packaging up these NuGet packages in a consistent, automated way, uses proper package naming under the org.nuget scope.

As an experimental feature, the OpenUPM registryuplinksopen in new windowto the UnityNuGet registry to make it easier to use a NuGet package for OpenUPM audiences.

Image 2

OpenUPM Uplinks to UnityNuGet

The uplink feature provides

  • OpenUPM registry sync with UnityNuGet registry hourly.
  • Cached tarballs are hosting on CDN as well.
  • You can view package detail via openupm-cli openupm view org.nuget.some-package.

The integration comes with a few limitations.

  • NuGet packages are not searchable or browseable on the OpenUPM website.
  • Search for NuGet packages via OpenUPM registry’s search endpoint will result in “404 packages not found”. This affects both openupm-cli’s search command and Unity PackMan’s search feature.

As a side-effect of the search issue,

  • NuGet packages will be invisible in Unity PackMan’s “My Registries” section, but still visible on the “In Project” section.
  • Unity console may warn “Error searching for packages” the first time open the PackMan.

The search issue may be resolved with an improved search endpoint behavior in the future.

Demo

Please check out the demo project at https://github.com/favoyang/com.example.nuget-consumeropen in new window.

What’s next?

Package maintainers could