Git Product home page Git Product logo

nuget-importer-for-unity's Introduction

NuGet importer for Unity

GitHub Test GitHub all releases GitHub release (latest by date including pre-releases) CodeFactor Grade openupm

"NuGet importer for Unity" is a fast, easy-to-use, and powerful editor extension that provides you to import NuGet packages into Unity. This package also fully supports native plugins. (This was inspired by GlitchEnzo/NuGetForUnity, but made from scratch.) 日本語はこちら。

demo

Features

  • High performance using asynchronous
  • Powerful dependency solving
  • Full support for native plugins
  • Support for Roslyn Analyzer
  • Support for CI/CD
  • Useful UI
  • UPM and unitypackage support
  • Compatible with GlitchEnzo/NuGetForUnity

Getting Start

via UPM (Unity Package Manager)

There are two ways to install the package: using the UPM (Unity Package Manager) or importing the .unitypackage.

Use This Git URL

  1. Open the Package Manager window.
  2. Click the add (+) button in the status bar.
  3. Select Add package from git URL.
  4. Enter "https://github.com/kumaS-nu/NuGet-importer-for-Unity.git?path=NuGetImporterForUnity/Packages/NuGet Importer" or "[email protected]:kumaS-nu/NuGet-importer-for-Unity.git?path=NuGetImporterForUnity/Packages/NuGet Importer".
  5. Click Add.

For more information, see the Official page (Installing from a Git URL - Unity).

Use OpenUPM

  1. If you have not installed OpenUPM-CLI, run the following command to install OpenUPM-CLI. (Node.js 12 is required.)
    npm install -g openupm-cli
  2. Go to the unity project folder
  3. Run the following command to install "NuGet importer for Unity" in your project.
    openupm add org.kumas.nuget-importer

For more information, see the Official page (Getting Started with OpenUPM-CLI - OpenUPM)

via .unitypackage

  1. Go to the release page and download the zip file of the version you need.
  2. Extract the zip file and import the .unitypackage into your project.

More Infomation

For more information or contributions, please see https://kumaS-nu.github.io/NuGet-importer-for-Unity .

License

This package is under Apache License 2.0.
Each package in NuGet is governed by the terms included with the package. For more details, see NuGet F&Q.

nuget-importer-for-unity's People

Contributors

alkee avatar chikacc avatar dependabot[bot] avatar kumas-nu avatar settingdust avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

nuget-importer-for-unity's Issues

Add assembly definition for analyzers

Is your feature request related to a problem? Please describe.

Currently, when using the NuGet-importer-for-Unity package, the static code analysis tools run on the entire codebase, which can be time-consuming and hinder development productivity.

Describe the solution you'd like

We would like to request the addition of assembly definition files to the NuGet-importer-for-Unity package, so that we can specify which assemblies the static code analysis tools should analyze. This would allow us to split the codebase into smaller, more manageable chunks and reduce the time it takes for the tools to run.

Describe alternatives you've considered

We have considered manually adding assembly definition files to our project, but this would require extra effort and may not be a viable solution for everyone using the package.

Additional context

As mentioned in the Unity documentation Roslyn analyzers and source generators, "Assembly definition files let you specify which files belong in a particular assembly. Analyzers use this information to determine the scope of their analysis." Adding assembly definition files to the NuGet-importer-for-Unity package would greatly improve the efficiency and usability of the static code analysis tools for all users of the package.


This issue was conceived by Chika Chang and translated by ChatGPT.

[BUG] NuGet dependencies are not installed along with package

Describe the bug
Installing a package does not automatically (always?) install its dependencies.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the NuGet Importer package gallery.
  2. Install Microsoft.MixedReality.QR version 0.5.3013.
  3. Click "Yes" when the package warns that the project is set to .NET Standard 2.0, but the package requires .NET Framework.
  4. The package is installed, but Microsoft.VCRTForwarders.140 isn't, which is listed as depedency.

Expected behavior
Package dependencies are installed along with packages, and their dependencies as well, all the way down the tree.

Desktop (please complete the following information):

  • OS: Linux x86-64
  • Unity Version: 2020.3.26f1
  • Package Version: 2.1.2

Additional context
I'm trying to migrate an existing code base using NuGetForUnity to this project, and it does (did) correctly install the dependencies.

I can still install the dependencies manually, but I need to assess manually what dependencies are necessary, which is cumbersome, and error-prone - if I forget, I may have runtime errors or compile-time errors (the former are worse since they might only show up in a corner case).

I'm not sure if this is already supposed to be working or not, or if it's not implemented yet. If it is supposed to be working, perhaps it's related to my project being set to use .NET Standard 2.0 and the package requiring .NET Framework? Although the package itself lists .NET Standard 2.0 as being supported, so I'm not sure why I got the warning (that may be another bug).

Unity 2020.3.0f1 (LTS) で動作しない

UPMを使用した場合
使用法 に記載されている通りUPMでプロジェクトにインストールすると以下のエラーが出て使用できない。

Library\PackageCache\org.kumas.nuget-importer@3e0d604704\Editor\PackageManager.cs(855,13): error CS0103: The name 'ZipFile' does not exist in the current context

.unitypackageを使用した場合
使用法 に記載されているとおりに.unitypackageをプロジェクトにインストールする。
NuGet Importer > Manage Packages をクリックするとメインウィンドウは開かず以下のエラーが出て使用できない。

ArgumentException: method return type is incompatible System.Delegate.CreateDelegate (System.Type type, System.Object firstArgument, System.Reflection.MethodInfo method, System.Boolean throwOnBindFailure, System.Boolean allowClosed) (at <eae584ce26bc40229c1b1aa476bfa589>:0) System.Delegate.CreateDelegate (System.Type type, System.Object firstArgument, System.Reflection.MethodInfo method) (at <eae584ce26bc40229c1b1aa476bfa589>:0) UnityEditor.HostView.CreateDelegate (System.String methodName) (at <50f55621a2ca4f31a35283e2979a8bf5>:0) UnityEditor.HostView.CreateDelegates () (at <50f55621a2ca4f31a35283e2979a8bf5>:0) UnityEditor.HostView.SetActualViewInternal (UnityEditor.EditorWindow value, System.Boolean sendEvents) (at <50f55621a2ca4f31a35283e2979a8bf5>:0) UnityEditor.DockArea.SetSelectedPrivate (System.Int32 value, System.Boolean sendEvents) (at <50f55621a2ca4f31a35283e2979a8bf5>:0) UnityEditor.DockArea.AddTab (System.Int32 idx, UnityEditor.EditorWindow pane, System.Boolean sendPaneEvents) (at <50f55621a2ca4f31a35283e2979a8bf5>:0) UnityEditor.DockArea.AddTab (UnityEditor.EditorWindow pane, System.Boolean sendPaneEvents) (at <50f55621a2ca4f31a35283e2979a8bf5>:0) UnityEditor.EditorWindow.CreateNewWindowForEditorWindow (UnityEditor.EditorWindow window, System.Boolean loadPosition, System.Boolean showImmediately, System.Boolean setFocus) (at <50f55621a2ca4f31a35283e2979a8bf5>:0) UnityEditor.EditorWindow.Show (System.Boolean immediateDisplay) (at <50f55621a2ca4f31a35283e2979a8bf5>:0) UnityEditor.EditorWindow.Show () (at <50f55621a2ca4f31a35283e2979a8bf5>:0) UnityEditor.EditorWindow.GetWindowPrivate (System.Type t, System.Boolean utility, System.String title, System.Boolean focus) (at <50f55621a2ca4f31a35283e2979a8bf5>:0) UnityEditor.EditorWindow.GetWindow (System.Type t, System.Boolean utility, System.String title, System.Boolean focus) (at <50f55621a2ca4f31a35283e2979a8bf5>:0) UnityEditor.EditorWindow.GetWindow[T] (System.Boolean utility, System.String title, System.Boolean focus) (at <50f55621a2ca4f31a35283e2979a8bf5>:0) UnityEditor.EditorWindow.GetWindow[T] () (at <50f55621a2ca4f31a35283e2979a8bf5>:0) kumaS.NuGetImporter.Editor.NuGetImporterWindow.ShowWindow () (at <0353acf8ba8b4dc8be80bf2737c008d8>:0)

環境

  • OS: Windows 10 Home 2004
  • Unity: Version 2020.3.0f1
  • Package: Version 1.1.0

その他
Unity 2019.4.22f1では正常に動作しています。

[Question] The menu item don't display

Question
IDK why is it happend. It works only 1 time. I want to using this package to manage nuget. So, I removed all nuget install by nugetforunity. Then, after recompile the menu item disappear. And I can't make it appear again.
I tried install nugetforunity and this package. After restart, the menu item of nugetforunity appearing. But not this package.
I have no idea for how can I debug for this. So creating a question

[BUG] Open project will get null exception

Describe the bug

Open project will get null exception.

To Reproduce

Steps to reproduce the behavior:

  1. Create unity project
  2. Add NuGet-importer-for-Unity package via OpenUPM
  3. Unity console shown as follows:
ArgumentNullException: Value cannot be null.
Parameter name: path1
System.IO.Path.Combine (System.String path1, System.String path2) (at <c2a97e0383e8404c9fc0ae19d58f57f1>:0)
kumaS.NuGetImporter.Editor.NuGetImporterSettings.get_Instance () (at Library/PackageCache/[email protected]/Editor/NuGetImporterSettings.cs:36)
kumaS.NuGetImporter.Editor.NuGetAnalyzerImportSetting.OnGeneratedCSProject (System.String path, System.String content) (at Library/PackageCache/[email protected]/Editor/NuGetAnalyzerImportSetting.cs:111)
System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <c2a97e0383e8404c9fc0ae19d58f57f1>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <c2a97e0383e8404c9fc0ae19d58f57f1>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <c2a97e0383e8404c9fc0ae19d58f57f1>:0)
Packages.Rider.Editor.ProjectGeneration.ProjectGeneration.OnGeneratedCSProject (System.String path, System.String content, System.Type[] types) (at Library/PackageCache/[email protected]/Rider/Editor/ProjectGeneration/ProjectGeneration.cs:369)
Packages.Rider.Editor.ProjectGeneration.ProjectGeneration.SyncProjectFileIfNotChanged (System.String path, System.String newContents, System.Type[] types) (at Library/PackageCache/[email protected]/Rider/Editor/ProjectGeneration/ProjectGeneration.cs:296)
Packages.Rider.Editor.ProjectGeneration.ProjectGeneration.SyncProject (Packages.Rider.Editor.ProjectGeneration.ProjectPart island, System.Type[] types) (at Library/PackageCache/[email protected]/Rider/Editor/ProjectGeneration/ProjectGeneration.cs:286)
Packages.Rider.Editor.ProjectGeneration.ProjectGeneration.GenerateAndWriteSolutionAndProjects (System.Type[] types) (at Library/PackageCache/[email protected]/Rider/Editor/ProjectGeneration/ProjectGeneration.cs:220)
Packages.Rider.Editor.ProjectGeneration.ProjectGeneration.Sync () (at Library/PackageCache/[email protected]/Rider/Editor/ProjectGeneration/ProjectGeneration.cs:144)
Packages.Rider.Editor.RiderScriptEditor.Initialize (System.String editorInstallationPath) (at Library/PackageCache/[email protected]/Rider/Editor/RiderScriptEditor.cs:262)
Unity.CodeEditor.CodeEditor.SetCodeEditor (System.String editorPath) (at <5f40cdb07bd44d76a23dad985a4ec283>:0)
Unity.CodeEditor.CodeEditor.Register (Unity.CodeEditor.IExternalCodeEditor externalCodeEditor) (at <5f40cdb07bd44d76a23dad985a4ec283>:0)
Packages.Rider.Editor.RiderScriptEditor..cctor () (at Library/PackageCache/[email protected]/Rider/Editor/RiderScriptEditor.cs:29)
UnityEngine.Debug:LogException(Exception)
Packages.Rider.Editor.RiderScriptEditor:.cctor() (at Library/PackageCache/[email protected]/Rider/Editor/RiderScriptEditor.cs:100)
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes(Type[])

Expected behavior

All clean, everything is happy.

Desktop (please complete the following information):

  • OS: Windows 11 21H2
  • Unity Version 2021.3.8f1
  • Package Version 2.3.1

Lack of ignore packages list

Problem
The standard libraries in .Net Standard 1.x are small, and some packages may include standard libraries as dependencies. Therefore, packages that do not need to be installed are also treated as dependencies. This extension excludes loaded assembly names by Unity from dependencies as an existing package to deal with this problem. However, there are default Unity packages not in assembly names.

Solution
Create additional ignore package lists.

What we need help
If anything is lacking in the ignore list, please add the package name as the comments on this issue.

Additional context
Below are the loaded assembly names that Unity includes.

List of loaded assembly names

UnityEngine
UnityEngine.AIModule
UnityEngine.ARModule
UnityEngine.AccessibilityModule
UnityEngine.AndroidJNIModule
UnityEngine.AnimationModule
UnityEngine.AssetBundleModule
UnityEngine.AudioModule
UnityEngine.ClothModule
UnityEngine.ClusterInputModule
UnityEngine.ClusterRendererModule
UnityEngine.CoreModule
UnityEngine.CrashReportingModule
UnityEngine.DSPGraphModule
UnityEngine.DirectorModule
UnityEngine.GIModule
UnityEngine.GameCenterModule
UnityEngine.GridModule
UnityEngine.HotReloadModule
UnityEngine.IMGUIModule
UnityEngine.ImageConversionModule
UnityEngine.InputModule
UnityEngine.InputLegacyModule
UnityEngine.JSONSerializeModule
UnityEngine.LocalizationModule
UnityEngine.ParticleSystemModule
UnityEngine.PerformanceReportingModule
UnityEngine.PhysicsModule
UnityEngine.Physics2DModule
UnityEngine.ProfilerModule
UnityEngine.RuntimeInitializeOnLoadManagerInitializerModule
UnityEngine.ScreenCaptureModule
UnityEngine.SharedInternalsModule
UnityEngine.SpriteMaskModule
UnityEngine.SpriteShapeModule
UnityEngine.StreamingModule
UnityEngine.SubstanceModule
UnityEngine.SubsystemsModule
UnityEngine.TLSModule
UnityEngine.TerrainModule
UnityEngine.TerrainPhysicsModule
UnityEngine.TextCoreModule
UnityEngine.TextRenderingModule
UnityEngine.TilemapModule
UnityEngine.UIModule
UnityEngine.UIElementsModule
UnityEngine.UIElementsNativeModule
UnityEngine.UNETModule
UnityEngine.UmbraModule
UnityEngine.UnityAnalyticsModule
UnityEngine.UnityConnectModule
UnityEngine.UnityCurlModule
UnityEngine.UnityTestProtocolModule
UnityEngine.UnityWebRequestModule
UnityEngine.UnityWebRequestAssetBundleModule
UnityEngine.UnityWebRequestAudioModule
UnityEngine.UnityWebRequestTextureModule
UnityEngine.UnityWebRequestWWWModule
UnityEngine.VFXModule
UnityEngine.VRModule
UnityEngine.VehiclesModule
UnityEngine.VideoModule
UnityEngine.VirtualTexturingModule
UnityEngine.WindModule
UnityEngine.XRModule
netstandard
Microsoft.Win32.Primitives
System.AppContext
System.Collections.Concurrent
System.Collections
System.Collections.NonGeneric
System.Collections.Specialized
System.ComponentModel
System.ComponentModel.EventBasedAsync
System.ComponentModel.Primitives
System.ComponentModel.TypeConverter
System.Console
System.Data.Common
System.Diagnostics.Contracts
System.Diagnostics.Debug
System.Diagnostics.FileVersionInfo
System.Diagnostics.Process
System.Diagnostics.StackTrace
System.Diagnostics.TextWriterTraceListener
System.Diagnostics.Tools
System.Diagnostics.TraceSource
System.Diagnostics.Tracing
System.Drawing.Primitives
System.Dynamic.Runtime
System.Globalization.Calendars
System.Globalization
System.Globalization.Extensions
System.IO.Compression
System.IO.Compression.ZipFile
System.IO
System.IO.FileSystem
System.IO.FileSystem.DriveInfo
System.IO.FileSystem.Primitives
System.IO.FileSystem.Watcher
System.IO.IsolatedStorage
System.IO.MemoryMappedFiles
System.IO.Pipes
System.IO.UnmanagedMemoryStream
System.Linq
System.Linq.Expressions
System.Linq.Parallel
System.Linq.Queryable
System.Net.Http
System.Net.NameResolution
System.Net.NetworkInformation
System.Net.Ping
System.Net.Primitives
System.Net.Requests
System.Net.Security
System.Net.Sockets
System.Net.WebHeaderCollection
System.Net.WebSockets.Client
System.Net.WebSockets
System.ObjectModel
System.Reflection
System.Reflection.Extensions
System.Reflection.Primitives
System.Resources.Reader
System.Resources.ResourceManager
System.Resources.Writer
System.Runtime.CompilerServices.VisualC
System.Runtime
System.Runtime.Extensions
System.Runtime.Handles
System.Runtime.InteropServices
System.Runtime.InteropServices.RuntimeInformation
System.Runtime.Numerics
System.Runtime.Serialization.Formatters
System.Runtime.Serialization.Json
System.Runtime.Serialization.Primitives
System.Runtime.Serialization.Xml
System.Security.Claims
System.Security.Cryptography.Algorithms
System.Security.Cryptography.Csp
System.Security.Cryptography.Encoding
System.Security.Cryptography.Primitives
System.Security.Cryptography.X509Certificates
System.Security.Principal
System.Security.SecureString
System.Text.Encoding
System.Text.Encoding.Extensions
System.Text.RegularExpressions
System.Threading
System.Threading.Overlapped
System.Threading.Tasks
System.Threading.Tasks.Parallel
System.Threading.Thread
System.Threading.ThreadPool
System.Threading.Timer
System.ValueTuple
System.Xml.ReaderWriter
System.Xml.XDocument
System.Xml.XmlDocument
System.Xml.XmlSerializer
System.Xml.XPath
System.Xml.XPath.XDocument
System.Numerics.Vectors
System.Runtime.InteropServices.WindowsRuntime
mscorlib
System.ComponentModel.Composition
System.Core
System.Data
System
System.Drawing
System.IO.Compression.FileSystem
System.Net
System.Numerics
System.Runtime.Serialization
System.ServiceModel.Web
System.Transactions
System.Web
System.Windows
System.Xml
System.Xml.Linq
System.Xml.Serialization

Delay before sending "Search" request after typing text in "search field"

First of all, you made an amazing plugin! This is much better than NuGetForUnity!

I just want to request a single feature that may improve usage. In my case, I have a slow internet connection, and when I type text into the search field it takes 5 seconds after each letter to search packages and doesn't allow me to continue typing.

My proposition
Add a delay after each typed letter, before sending a network request. If a new letter was typed in the delay period - cancel the previous delay and create a new one. That is all.

Just in case how to do that ease. In UniRx library for Unity exists a cool reactive method "Throttle", it does the job.

onSearchFieldUpdated
  .Throttle(TimeSpan.FromSeconds(1))
  .Subscribe(x =>
  {
    // Make a request here
  });

[BUG] Warning shown about compatible packages

Describe the bug
When the project is set to .NET Standard 2.0, and the package is compatible with .NET Standard 2.0, a warning is still shown.

To Reproduce
Steps to reproduce the behavior:

  1. Set the project to use API level .NET Standard 2.0.
  2. Try to install Microsoft.MixedReality.QR version 0.5.3013.
  3. See warning.

Expected behavior
No warning is printed, as the package is compatible with .NET Standard 2.0 as well.

Desktop (please complete the following information):

  • OS: Linux x86-64
  • Unity Version: 2020.3.26f1
  • Package Version 2.1.2

Additional context
Not a major problem, just a minor paper cut 🙂 .

Enhance path matching pattern of analyzer

Is your feature request related to a problem? Please describe.
I tried to add MessagePackAnalyzer, but the path of the package does not match the path matching pattern of the analyzer in NuGetAnalyzerImportSetting, so after importing it Unity will scream in the console.

Describe the solution you'd like
Change the path matching pattern of the package, e.g. analyzers[/\\]dotnet[/\]

Describe alternatives you've considered

  • Do not use MessagePackAnalyzer
  • Manually add MessagePackAnalyzer plugin
  • Suggest MessagePackAnalyzer modify nuget package path
  • Suggest NuGet-importer-for-Unity modify analyser's path matching pattern

Additional context

  • MessagePackAnalyzer's analyser path Packages/org.nuget.messagepackanalyzer/analyzers/dotnet/MessagePackAnalyzer.dll
  • Analyzer NuGet formats

Another installation location option

Problem
To install external packages, it is more natural to locate them under Packages/ instead of Assets/Packages/.

Solution you'd like
We will prepare both as options for the installation location, and recommend the location under Packages/.

Describe alternatives you've considered
Install package by creating it as a local package.

[BUG] 他のマシンで共有して使用できない

バクの詳細
csc.rsp共有時,Define Symbolsが設定されない.

再現方法
再現方法を書いてください:

  1. あるマシンで導入し,共有.
  2. 他のマシンで使用できなくなる

想定される正しい動作
csc.rspに関わらずDefine Symbolsが適切に設定される.

[BUG] Error at Installing Microsoft.Win32.Registry package

Can't install Microsoft.Win32.Registry package version 5.0.0

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'NuGet importer'
  2. Type Microsoft.Win32.Registry
  3. Choose version 5.0.0
  4. Press Install

Expected behavior
Success installation

Screenshots
image

Desktop (please complete the following information):

  • OS: [e.g. Windows 10 Pro]
  • Unity Version [e.g. 2020.3.25f1]
  • Package Version [e.g. 2.2.1]

[BUG] Repairing all packages doesn't seem to be the same as repairing packages individually

Describe the bug
If I have a NuGet setup where a couple of packages are installed in my rootPackages.xml, and I remove the NuGet root folder and Packages/FooDependency folders, doing Repair Packages through Unity does not restore these folders.

To Reproduce
Steps to reproduce the behavior:

  1. Install some packages.
  2. Remove the NuGet folder.
  3. Remove the installed package folders in Packages (e.g. Packages/Foo).
  4. Restart Unity.
  5. Errors occur because the packages are missing their files (expected). Click Repair packages.
  6. The repair finishes, but the files are not restored.

Expected behavior
The files are restored.

Desktop (please complete the following information):

  • OS: Linux x86-64
  • Unity Version: 2020.3.26f1
  • Package Version 2.1.2

Additional context
Clicking Repair on each package in the list Installed packages does properly restore the folders, but it's a bit cumbersome as you need to click them one by one.

The reason I was testing this is because when you share a project with colleagues and use Git, you are only going to be sharing the package configuration (rootPackages.xml as general package configuration, and perhaps packages.config as lock file), but not the actual contents of the packages. It'd be ideal if the package could assess that some packages are missing on Unity startup (project load) and install the missing ones if necessary. This is what NuGetForUnity does as well. Barring that, reparing them all manually through the button could also work.

Automatically activate Roslyn analyzers in NuGet packages in Unity

Is your feature request related to a problem? Please describe.
Unity supports running Roslyn analyzers which can be installed through NuGet. The main downside in Unity is that they recommend grabbing the DLL from the NuGet package and dropping it in your project, which is unfortunate since it doesn't allow automatic updating of the package, and forces you to include packages in version control.

Describe the solution you'd like
When a package containing Roslyn analyzers is installed, they are automatically registered with Unity as roslyn analyzers.

Describe alternatives you've considered
Installing them manually the Unity way or making a script to install them (which is what I'm doing for the moment).

Additional context
Examples of such packages include Roslynator, ErrorProne, and Microsoft Unity Analyzers.

Automating this comes down to the following:

  1. Download and extract the NuGet package (already happens).
  2. Search for analyzer DLLs in the package, copy them to the Assets/Scripts/Foo folder (or another folder that is picked up by Unity).
  3. Either generate or update a matching meta file for each DLL that has the RoslynAnalyzer label set (or Unity will not recognize the DLL as an analyzer).

I'm not sure how to recognize DLLs that are analyzers as opposed to regular assemblies for step 2, but looking at the above examples, they all use subfolders analyzers/dotnet/cs to store these DLLs in.

If users do not want to run these analyzers automatically (as their errors block play mode), they can simply disable Roslyn analyzer support in the Unity project settings, so it should be safe to always do this.

Finally, an added bonus to this is that Unity (2020 and up) will also put these analyzers in C# project files generated for e.g. VSCode, so OmniSharp will also be able to use them.

Support for binding redirects

Is your feature request related to a problem? Please describe.
PlayerSettings.assemblyVersionValidation has been obsolete since Unity2022.2, Unity says to use binding redirects instead.

Describe the solution you'd like
Use binding redirects.

Additional context
You can override package references by using binding redirects. This makes it possible to use packages that depend on Microsoft.Bcl associations even in Unity 2021.3 and later.

[BUG] Unity 2021.2 に導入不可

Git URL を指定する方法で導入しています。コンパイルエラーが表示され、期待している動作がしません。

下記のエラーが表示されます。
[Error] 'ApiCompatibilityLevel' does not contain a definition for 'NET_4_8'
[Error] The switch statement contains multiple cases with the label value '6'

環境 :

  • OS: Windows 10 Pro 21H1
  • Unity Version 2021.2.11f1
  • Package Version 2.1.0

FrameworkName.cs
辺りを弄るも解決に至らず・・・すみませんが解決策を教えてください。

※Unity Version 2020.3.27f1では利用できています。 

Unity Editor failed to load dlls

I am trying to use System.Text.Json installed by importe, but when trying to run play mode in editor, it fails to load some of the dependencies.

Once I move all downloaded dlls to the same folder, everything works as expected.
Is there a way to teach unity editor to seek for dlls everywhere, or maybe we can change importer in the way it puts all dlls in same folder?

[BUG] Central Directory Corrupt

Describe the bug
Try to install Microsoft.CodeAnalysis.Common package, and after downloading, get this:

Screenshots
image

Desktop (please complete the following information):

  • OS: Win10
  • Unity Version 2021.2.16f1
  • Package Version 2.2.0

Support SDK-style projects

Is your feature request related to a problem? Please describe.
Unity has decided to drop support for the VSCode package. A community alternative has already surfaced, and supports modern SDK-style C# projects. When using SDK-style projects, however, this package breaks immediately on start-up because OnGeneratedCSProject.OnGeneratedCSProject tries to parse the project.

Describe the solution you'd like
Support for newer SDK-style projects.

Describe alternatives you've considered
Stick to the old Unity package.

Additional context
Since support has been dropped, it's only a matter of time before the community fork becomes the de facto standard. SDK-style projects have been the default for .NET projects for years now, but Unity was lagging behind in supporting only legacy-style projects.

Also, use of SDK-style projects allows gaining substantially improved performance in tools such as OmniSharp by using modern .NET 6 builds.

Error thrown by the package when using a modern SDK-style project:

NullReferenceException: Object reference not set to an instance of an object
kumaS.NuGetImporter.Editor.NuGetAnalyzerImportSetting.OnGeneratedCSProject (System.String path, System.String content) (at Library/PackageCache/[email protected]/Editor/NuGetAnalyzerImportSetting.cs:118)
System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <8516445456524a6cb20c4b3b7de67982>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <8516445456524a6cb20c4b3b7de67982>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <8516445456524a6cb20c4b3b7de67982>:0)
VSCodeEditor.ProjectGeneration.InvokeAssetPostProcessorGenerationCallbacks (System.String name, System.String path, System.String content) (at Library/PackageCache/com.unity.ide.vscode@67c02d0abf/Editor/ProjectGeneration/ProjectGeneration.cs:237)
VSCodeEditor.ProjectGeneration.OnGeneratedCSProject (System.String path, System.String content) (at Library/PackageCache/com.unity.ide.vscode@67c02d0abf/Editor/ProjectGeneration/ProjectGeneration.cs:250)
VSCodeEditor.ProjectGeneration.SyncProjectFileIfNotChanged (System.String path, System.String newContents) (at Library/PackageCache/com.unity.ide.vscode@67c02d0abf/Editor/ProjectGeneration/ProjectGeneration.cs:435)
VSCodeEditor.ProjectGeneration.SyncProject (UnityEditor.Compilation.Assembly assembly, System.Collections.Generic.Dictionary`2[TKey,TValue] allAssetsProjectParts, System.Collections.Generic.List`1[T] responseFilesData) (at Library/PackageCache/com.unity.ide.vscode@67c02d0abf/Editor/ProjectGeneration/ProjectGeneration.cs:428)
VSCodeEditor.ProjectGeneration.GenerateAndWriteSolutionAndProjects () (at Library/PackageCache/com.unity.ide.vscode@67c02d0abf/Editor/ProjectGeneration/ProjectGeneration.cs:348)
VSCodeEditor.ProjectGeneration.Sync () (at Library/PackageCache/com.unity.ide.vscode@67c02d0abf/Editor/ProjectGeneration/ProjectGeneration.cs:261)
VSCodeEditor.VSCodeScriptEditor.SyncAll () (at Library/PackageCache/com.unity.ide.vscode@67c02d0abf/Editor/VSCodeScriptEditor.cs:170)
UnityEditor.CodeEditorProjectSync.SyncEditorProject () (at /home/bokken/buildslave/unity/build/Editor/Mono/CodeEditor/CodeEditorProjectSync.cs:21)

[BUG] Unity still recompiles scripts when cancelling various actions

Describe the bug
When cancelling actions by closing dialog boxes such as "There is no available version", Unity still recompiles scripts unnecessarily (as nothing happened).

To Reproduce
Steps to reproduce the behavior:

  1. Make sure "Include development versions" is not enabled (the default).
  2. Try to install FakeItEasy 7.3.1.
  3. See message "There is no available version."
  4. Click OK.
  5. Unity starts recompiling scripts.

Expected behavior
Unity does not recompile scripts.

Desktop (please complete the following information):

  • OS: Linux x86-64
  • Unity Version: 2020.3.26f1
  • Package Version 2.1.2

Additional context
Not a major problem, just a minor paper cut 🙂 .

[BUG] `'Package' does not contain a definition for 'targetFramework'`

Describe the bug
Well. A bug

Library\PackageCache\org.kumas.nuget-importer@e006d74628\Editor\PackageOperation\OperatePackage.cs(251,112): error CS1061: 'Package' does not contain a definition for 'targetFramework' and no accessible extension method 'targetFramework' accepting a first argument of type 'Package' could be found (are you missing a using directive or an assembly reference?)

[BUG] Thumbnails fail to render on Unity OpenGL back end

Describe the bug
If Unity is set to use the OpenGL back end, as is the default on Linux, thumbnails for packages don't show up.

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'NuGet Importer'
  2. Click on 'Manage Packages'
  3. See error in Unity console.

Expected behavior
The thumbnails display properly.

Screenshots
afbeelding

Desktop (please complete the following information):

  • OS: Arch Linux x86-64
  • Unity Version: 2020.3.26f1
  • Package Version: 2.3.1

Additional context
The logs of the error in the console, which are repeated many times (probably once per thumbnail):

OPENGL: Graphics.CopyTexture called on textures with different mip count (8 vs 7)?
UnityEngine.Graphics:ConvertTexture (UnityEngine.Texture,UnityEngine.Texture)
kumaS.NuGetImporter.Editor.PackageDataExtentionToGUI/<GetIcon>d__12:MoveNext () (at Library/PackageCache/[email protected]/Editor/PackageDataExtentionToGUI.cs:592)
System.Reflection.MethodBase:Invoke (object,object[])
Microsoft.MixedReality.Toolkit.Utilities.SyncContextUtility:ExecuteContinuations () (at Library/PackageCache/[email protected]/Core/Utilities/Async/Internal/SyncContextUtility.cs:53)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()

OPENGL: Graphics.CopyTexture called on textures of different sizes?
UnityEngine.Graphics:ConvertTexture (UnityEngine.Texture,UnityEngine.Texture)
kumaS.NuGetImporter.Editor.PackageDataExtentionToGUI/<GetIcon>d__12:MoveNext () (at Library/PackageCache/[email protected]/Editor/PackageDataExtentionToGUI.cs:592)
System.Reflection.MethodBase:Invoke (object,object[])
Microsoft.MixedReality.Toolkit.Utilities.SyncContextUtility:ExecuteContinuations () (at Library/PackageCache/[email protected]/Core/Utilities/Async/Internal/SyncContextUtility.cs:53)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()

[BUG] Some search terms break search

Describe the bug
If I open the package window and enter specific terms to search, errors are posted every second or so and no results appear.

To Reproduce
Steps to reproduce the behavior:

  1. Open the search window.
  2. Type Microsoft.MixedReality.QR.
  3. Press enter/return.

Expected behavior
The expected results appear.

Desktop (please complete the following information):

  • OS: Linux x86-64
  • Unity Version: 2021.3.6f1
  • Package Version 2.3.2

Additional context
The error that is posted is the following:

You cannot call GetLast immediately after beginning a group.
UnityEngine.GUILayoutUtility:GetLastRect ()
kumaS.NuGetImporter.Editor.NuGetImporterWindow:OnGUI () (at Library/PackageCache/[email protected]/Editor/NuGetImporterWindow.cs:427)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /home/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)

[Feature request] Option for mark libraries as "Provided by Unity"

Hello. I would like to install LanguageExt.Core with this plugin, which depends on Microsoft.CSharp. But Microsoft.CSharp is already provided by Unity Mono runtime, making a compile conflict error. If manually removing the generated package in package manager, code can be correctly compiled but it will still suggest to install Microsoft.CSharp, which is quite annoying.

[BUG] InvalidOperationException when open the gui

Describe the bug

InvalidOperationException: Sequence contains no matching element
System.Linq.Enumerable.First[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) (at <f7fbcd1d5c764324ac3af6826a20de0b>:0)
kumaS.NuGetImporter.Editor.NuGetImporterWindow.UpdateInstalledList () (at ./Library/PackageCache/[email protected]/Editor/NuGetImporterWindow.cs:394)
kumaS.NuGetImporter.Editor.NuGetImporterWindow.UpdateData () (at ./Library/PackageCache/[email protected]/Editor/NuGetImporterWindow.cs:318)
UnityEngine.Debug:LogException(Exception)
kumaS.NuGetImporter.Editor.<UpdateData>d__36:MoveNext() (at ./Library/PackageCache/[email protected]/Editor/NuGetImporterWindow.cs:371)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:Start(<UpdateData>d__36&)
kumaS.NuGetImporter.Editor.NuGetImporterWindow:UpdateData()
kumaS.NuGetImporter.Editor.NuGetImporterWindow:set_Selected(Int32) (at ./Library/PackageCache/[email protected]/Editor/NuGetImporterWindow.cs:35)
kumaS.NuGetImporter.Editor.NuGetImporterWindow:OnGUI() (at ./Library/PackageCache/[email protected]/Editor/NuGetImporterWindow.cs:410)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

To Reproduce
Start

Screenshots
IDK if it relating to issue. But the progress stuck at get icon at the same time
图片

Desktop (please complete the following information):

  • OS: [e.g. Windows 10 Pro 1909] Windows 22H2
  • Unity Version [e.g. 2019.4.14f1] 2022.2.7f1c1
  • Package Version [e.g. 1.0.0] 3.3.0

Additional context
Add any other context about the problem here.

Wrong usage of `IEnumerable`

Is your feature request related to a problem? Please describe.
Such as installPackages at https://github.com/kumaS-nu/NuGet-importer-for-Unity/blob/main/NuGetImporterForUnity/Packages/NuGet%20Importer/Editor/PackageOperation/OperatePackage.cs#L117-L119
IEnumerable shouldn't iterate multiple times. It's fine here is caused by the input always array/list that is ICollection
Many IEnumerable should be ICollection for avoiding confusing when further developing and contributing

Use local NuGet cache

Problem
By using the cache that already exists during installation, we can save time.

Solution
Refer to the local NuGet cache during installation, and use the package if it exists.

Alternatives you've considered
This is an unofficial project, so we should not save package in the NuGet cache.

[BUG] Broken in Linux Editor with recent updates (ZIP_AVAILABLE?)

Describe the bug
On the Linux Editor in 2021.3, I can install the package just fine, but no menu items are ever added for the package. After some digging, it turns out ZIP_AVAILABLE is false, resulting in most of the code being compiled out.

To Reproduce

  1. Install the package.
  2. Focus Unity.

Expected behavior
The package works as intended and shows its menu items in Unity.

Desktop (please complete the following information):

  • OS: Arch Linux x86-64
  • Unity Version: 2021.3.3
  • Package Version: 2.3.1

Additional context
I reported some other bugs previously, so this package worked at some point. I wanted to get back to it today, but can't get it to actually work any more. I am on the .NET Standard 2.1 profile, and looked at the source code briefly, and see that it tries to write a csc.rsp file if necessary, and it is written, but it has no effect - according to the Unity documentation, csc.rsp is not meant for the .NET Standard profile either.

Normally the ZIP_AVAILABLE symbol should be added regardless, however, but still Unity refuses to load the menu items. Is this perhaps a problem with Unity 2021.3, or do I have to add this define somewhere myself?

FWIW, removing all these directives fixes the issue.

About assembly check

Problem
Unity's assemblies are custom, so the current v2.0.0 has duplicate packages.

Describe the solution you'd like
Check not only the assembly name, but also the namespace and type.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.