cs-util-com / cscore

cscore is a minimal-footprint library providing commonly used helpers & patterns for your C# projects. It can be used in both pure C# and Unity projects.
https://cs-util-com.github.io/cscore/
Apache License 2.0
195 stars 32 forks source link

Compiler Error with Unity 2021.2.2f1 (.Net Standard 2.1) #68

Closed Dak0r closed 2 years ago

Dak0r commented 2 years ago

Hi, thanks for your great work here! It looks like there's no perfect fix, and so I thought you might want to look at it yourself.

Issue: The cscore Unity Package doesn't work without changes in Unity 2021.2.2f1 which uses .Net Standard 2.1.

There's a clash between the ToHashSet implementation in com.csutil.netstandard2_1polyfill and System.Linq, if a class uses both. This affects BackButtonListener.cs and RootCanvas.cs of cscore unity.

Unfortunately, Unity doesn't seem to define NETSTANDARD2_1_OR_GREATER or NETSTANDARD2_1 so it might get a little tricky, but I think the Polyfill should be disabled if .Net Standard 2.1 or greater is used.

Dak0r commented 2 years ago

Just tested it with 1.4.21, and it's fixed :)