Roslyn analyzers for Unity game developers
- Showing the top 5 NuGet packages that depend on Unity.Interception: Package Downloads; EnterpriseLibrary.Common.NetCore The Enterprise Library Common assembly contains elements that are shared among multiple application blocks. By supplying a set of commonly used functions to all the application blocks, the Common assembly reduces the.
- With the changes below a huge number of new nuget packages are working with Nuget for Unity! Greatly improved logic for selecting target frameworks, including.NET Standard. New support for Dependencies grouped by target framework. Issues installing newer versions of modules with 100 versions have been fixed.
The Unity Application Block (Unity) is a lightweight extensible dependency injection container with support for constructor, property, and method call injection. It facilitates loosely-coupled design. NuGetForUnity is a NuGet client built from scratch to run inside the Unity Editor. NuGet is a package management system which makes it easy to create packages that are distributed on a server and consumed by users. NuGet supports sematic versioning for.
Documentation for this release.
Show moreDependencies
.NETStandard 2.0
- No dependencies.
Used By
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (3)
Showing the top 3 popular GitHub repositories that depend on Microsoft.Unity.Analyzers:
Repository | Stars |
---|---|
CitiesSkylinesMods/TMPE Cities: Skylines Traffic Manager: President Edition | |
IllusionMods/BepisPlugins A collection of essential BepInEx plugins for games made by Illusion. | |
DeathWeasel1337/KK_Plugins Plugins for Koikatsu, EmotionCreators, AI Girl, and Honey Select 2 |
Version History
Version | Downloads | Last updated |
---|---|---|
1.10.1 | 82 | 4/20/2021 |
1.10.0 | 1,177 | 2/16/2021 |
1.9.1 | 782 | 1/5/2021 |
1.9.0 | 749 | 11/21/2020 |
1.8.2 | 427 | 9/22/2020 |
1.8.1 | 190 | 9/2/2020 |
1.8.0 | 316 | 7/20/2020 |
1.7.1 | 293 | 6/19/2020 |
1.7.0 | 791 | 6/9/2020 |
This project provides nuget support trough sdk-style csproj files in Unity, with a Unity Editor tool.
The editor utility can be started from the Unity Csproj / Open window menu item.
The project assumes that you are using asmdef in your project in a structure:
This might change in the future, but right now it is a recommended pattern nevertheless.
Why this and not NugetForUnity
Although NugetForUnity is a great project, it has several constraints:
- Can’t easily use specific nuget versions through nugget.org
- It still has problems with downloading the required dlls 123
- If you are working on other projects the generated csproj file can be used to directly reference them making it easier to work with projects not directly targeting Unity. Just add a reference to it.
Nuget Unity Package
How does it work?
The main idea is this blog post I wrote a while back. We are creating a .net framework project which we will use to generate the needed dlls, and then let Unity discover them. This project builds on that concepts, and automates the creation of the needed project file.
How do I use it?
- Install the dotnet core sdk, and make sure it is available in your PATH
- Install the project through either openupm (this is recommended) or with the provided unitypackage.
- Launch the csproj window as shown on the above image
- This window will enumerate through all of your asmdef files, and will let you create a csproj file for it’s dependencies, and also place a folder named NugetDlls with a gitignore for the dlls and their meta files. The csproj is placed in a folder called .nuget which will be ignored by Unity. If you do not want to use the provided gitignore files, then delete them after initialization.
- Regenerate the Unity project files through either the “Regenerate project file” button, or in the Unity options: “Edit/Preferences/External Tools”.
- Launch Visual Studio and add nuget packages to the generated project file, or use the dotnet cli tools
- Build the generated project from either Visual Studio, the dotnet cli or through the provided Editor UI
- (Optional) This is not needed if your are using Unity 2020.1 and have the latest Visual Studio package. If you are using Visual Studio to debug then unload the generated projects from Visual Studio, so they do not interfere when attaching to Unity.
- You are done!
Nuget Unity Container
Settings
Setting | Description |
---|---|
Add projects to solution | Whether to add the initialized projects to the unity-generated solution file, when the project is regenerated |
Nuget Unityengine
Settings are persisted in the root unity folder in the NugetOptions.xml file. To save and apply the settings press the “Save settings” button.
Additional stuff
Add Nuget Package To Unity
- When Unity generates the solution files your nuget projects will be added to the solution. If you want to debug your Unity project you may need to unload them from the solution by right clicking on them in Visual Studio. (Only when using Unity older than 2020.1)
- If you want to use this in a CI-CD environment then you don’t need to manually run dotnet build for the nuget projects. The project comes with an IPreprocessBuildWithReport which will do the same thing as the Build All button.
- Running the build command will replicate the output of the dotnet cli to the Unity Debug console.
Gotchas
Add Nuget Package
- Although it was not tested on Linux and MacOS building the generated projects should work via the .Net Framework reference assemblies, so a dotnet -build should just work.
- You only need to initialize a project once, when you set this up. Initializing again might override the packages you added.
- Tested with Unity version 2019.4 but other recent versions (2018+) should work
- The same gotchas are expected when just dealing with manually adding dlls
- Never forget that this project does nothing magical, it just automates the process of getting the needed dlls to be recognized with Unity