How to install NuGet packages in Unity


Unity is a very strange tool from .NET user’s view. It’s for Unity doesn’t provide the NuGet package manager as a first-party tool. Unity users should work with a third-party NuGet package manager. So, if you need it setup to your unity project.

Introduction

The procedure for installing NuGet Package Manager to Unity is as follows.

  1. Access https://github.com/GlitchEnzo/NuGetForUnity
  2. Download binary in release page
  3. Drag and drop to your Unity project
  4. Restart your Unity project

Advanced

If you like command line, try this example shell script. It’s without handling error.

WorkingDir=~/Desktop/UnityNuget                                                                                                                        
UnityProjectDir=${WorkingDir}/Unity                                                                                                               
NuGetUnityPkgUrl=https://github.com/GlitchEnzo/NuGetForUnity/releases/download/v3.0.1/NugetForUnity.3.0.1.unitypackage                            
UnityApp=/Applications/Unity/2019.4.20f1/Unity.app/Contents/MacOS/Unity                                                                           
                                                                                                                                                  
mkdir -p ${WorkingDir} && cd ${WorkingDir}                                                                                                        
curl -L -O ${NuGetUnityPkgUrl}                                                                                                                       
                                                                                                                                                  
${UnityApp} -quit \                                                                                                                               
            -createProject ${UnityProjectDir} \                                                                                                   
            -importPackage ${WorkingDir}/NugetForUnity.3.0.1.unitypackage

Result is here. (Click to play)