• Stars
    star
    572
  • Rank 77,995 (Top 2 %)
  • Language
    C#
  • License
    BSD 2-Clause "Sim...
  • Created over 5 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Provides a service to install NuGet packages into a Unity project via the Unity Package Manager

UnityNuGet Build Status

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.

Installation

Add scope registry (manifest.json):

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"
  }
}

Add scope registry (Package Manager UI):

Instructions: https://docs.unity3d.com/Manual/class-PackageManager.html

Name: Unity NuGet

Url: https://unitynuget-registry.azurewebsites.net

Scope(s): org.nuget

Disable Assembly Version Validation

This step is necessary to ensure that binding redirects for strongly named assemblies in NuGet packages resolve correctly to paths within the Unity project.

  • In Unity 2022.2+, this is the default behavior, so no action is required.
  • For earlier Unity versions, uncheck "Project Settings > Player > Other Settings > Configuration > Assembly Version Validation"

Verify installation

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

Cache locations by OS: https://docs.unity3d.com/Manual/upm-cache.html

When opening the Package Manager Window, you should see a few packages coming from NuGet (with the postfix text (NuGet))

UnityEditorWithNuGet

Adding a package to the registry

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 not 1.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)

You also need 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.

Compatibility

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

Docker

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.

Accessing a private NuGet feed from Azure DevOps

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.

FAQ

Where is hosted this service?

On Azure through my own Azure credits coming from my MVP subscription, enjoy!

Why can't you add all NuGet packages?

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.

Why does it require .NETStandard2.0?

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.

More information: https://docs.unity3d.com/Manual/dotnetProfileSupport.html

How this service is working?

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.

License

This software is released under the BSD-Clause 2 license.

Author

Alexandre Mutel aka xoofx

More Repositories

1

markdig

A fast, powerful, CommonMark compliant, extensible Markdown processor for .NET
C#
4,271
star
2

zio

A cross-platform abstract/virtual filesystem framework with many built-ins filesystems for .NET
C#
707
star
3

dotnet-releaser

Easily build, run tests and coverage, cross-compile, package and publish your .NET library or application to NuGet and GitHub.
C#
615
star
4

CppAst.NET

CppAst is a .NET library providing a C/C++ parser for header files powered by Clang/libclang with access to the full AST, comments and macros
C#
352
star
5

SharpYaml

SharpYaml is a .NET library for YAML compatible with CoreCLR
C#
312
star
6

Tomlyn

Tomlyn is a TOML parser, validator and authoring library for .NET Framework and .NET Core
C#
290
star
7

kalk

kalk is a powerful command line calculator app for developers.
C#
243
star
8

JitBuddy

Disassemble to x86/x64 ASM listing the native code generated by the JIT of a managed method.
C#
219
star
9

Varena

Varena is a .NET library that provides a fast and lightweight arena allocator using virtual memory.
C#
121
star
10

Blake3.NET

Blake3.NET is a fast managed wrapper around the SIMD Rust implementations of the BLAKE3 cryptographic hash function.
C#
116
star
11

LibObjectFile

LibObjectFile is a .NET library to read, manipulate and write linker and executable object files (e.g ELF, DWARF, ar...)
C#
91
star
12

CppAst.CodeGen

An extensible library providing C# PInvoke codegen from C/C++ files for .NET
C#
91
star
13

git-rocket-filter

Rewrite git branches in a powerful way
C#
82
star
14

gcix

A cross-platform implementation of the Immix Garbage Collector
C++
70
star
15

ManagedJit

Prototype of writing a managed JIT in C# with CoreCLR
C++
68
star
16

NWindows

NWindows is a cross-platform window creation and management library for .NET
C#
67
star
17

grpc-curl

grpc-curl is a command line tool for interacting with gRPC servers
C#
66
star
18

Broslyn

A lightweight utility library to create a Roslyn AdhocWorkspace from an existing solution or a csproj
C#
55
star
19

SharpScss

A portable cross-platform pinvoke .NET wrapper around libsass to convert SCSS to CSS
C#
52
star
20

Antlr4Ast

Antlr4Ast is a .NET library that provides a parser and abstract syntax tree (AST) for ANTLR4/g4 files.
C#
43
star
21

Monocypher.NET

.NET wrapper around the cryptographic library Monocypher https://monocypher.org/
C#
40
star
22

SharpDoc

SharpDoc is a documentation tool to generate HTML documentation for .NET projects
C#
39
star
23

SharpNng

SharpNng is a lightweight low-level managed wrapper around the Lightweight Messaging Library NNG
C#
37
star
24

SuperluminalPerf

SuperluminalPerf is a small .NET managed wrapper around the Superluminal PerformanceAPI.
C#
33
star
25

NPlug

Develop VST3 audio native plugins with .NET
C#
30
star
26

GitLib.NET

GitLib.NET is a bare metal P/Invoke wrapper around libgit2 for .NET
C#
28
star
27

jsonite

A lightweight, fast and compliant JSON serializer/deserializer/validator for .NET
C#
20
star
28

SharpRazor

A lightweight templating system using Razor
C#
19
star
29

smash

Smash provides a collection of non-cryptographic hashes for .NET
C#
15
star
30

XelaBuild

Playground for testing msbuild in a "server" mode
C#
15
star
31

SharpDiff

A fork of https://difflib.codeplex.com/
C#
13
star
32

NTar

A single file C# file to untar file entries from a tar stream.
C#
11
star
33

SharpPdbPatcher

A library/console program to replace source paths stored in a .NET PDB file
C#
9
star
34

AnalyzerPack

Repackage your current project as a Diagnostic Analyzer NuGet package
PowerShell
9
star
35

YamlSerializer

Fork of https://yamlserializer.codeplex.com/
C#
8
star
36

xoofx.github.io

Repository of my blog
HTML
7
star
37

NPlug.Samples

Samples for creating VST3 audio native plugins with NPlug and .NET7+/NativeAOT.
C#
7
star
38

BenchNativeApp

A small suite of micro-benchmarks for testing .NET Native and RyuJIT
C#
4
star
39

MarkdigAutoEmail

C#
3
star
40

dotnet-repo-xoofx

My .NET project/solution template.
C#
3
star
41

draytek-watcher

Daemon to reboot the WAN interface of a DrayTek router if it looks down
C#
2
star
42

scoop-kalk

Scoop repository for https://github.com/xoofx/kalk.
1
star
43

RoslynErrorApp

Repro project failing to run with Roslyn + .NET 5 installed
C#
1
star
44

homebrew-grpc-curl

Homebrew repository for https://github.com/xoofx/grpc-curl
Ruby
1
star
45

SharpDX.Toolkit.Game.Direct2D

Provides Direct2D and DirectWrite to Toolkit's Game class
C#
1
star
46

scoop-grpc-curl

Scoop repository for https://github.com/xoofx/grpc-curl.
1
star
47

atlassian.net-sdk

Fork of atlassian.net-sdk from bitbucket to test the JIRA REST API
C#
1
star