Note 1: These steps only tested in Macos environment
Note 2: This is based on https://medium.com/@alexandredemersroberge/use-nuget-packages-with-unity-25b8525f628
Configuration steps:
- Check Mono installation (eg. type in Terminal
mono --version
) - Open Rider and select creating new Project
- Select
Class Library
(under.NET Framework
) - Edit solution name field
- Edit solution directory field by choosing Unity project root folder (Rider will create project root folder by itself)
- Edit framework field and choose
.Net Framework v4.8
- Hit
Create
- [macos] If project has errors related to missing
.Net Framework
, download it from Mono (https://www.mono-project.com/download/stable/). Homebrew will not help - Unload the project (Right click on project in Explorer -> Unload Project)
- Double click on project in Explorer to modify its content
- To the bottom (right before
</Project>
) add following:<!-- Move the DLL to the Unity project. --> <Target Name="AfterBuild"> <PropertyGroup> <TargetDir>..\..\Assets\Plugins\$(AssemblyName)\Resources</TargetDir> </PropertyGroup> <ItemGroup> <SourceDir Include="bin\Debug\**\*.*" Condition="'$(Configuration)' == 'Debug'"/> <SourceDir Include="bin\Release\**\*.*" Condition="'$(Configuration)' == 'Release'"/> </ItemGroup> <Copy SourceFiles="@(SourceDir)" DestinationFolder="$(TargetDir)" SkipUnchangedFiles="true"/> </Target>
- Load the project (Right click on project in Explorer -> Load Project)
- Install desired NuGet package
- Select
Debug
orRelease
build configuration - Build solution (hit
Build Solution (⌘F9)
button) - After successful build you can find newly created dll at
{UnityProject}/Assets/Plugins/{SolutionName}/Resources