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

./images/figure_02.png

Advanced

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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.

./images/figure_03.gif

Conclusion

Finally, i hope that the NuGet package manager will be standard equipment on Unity.