- Home /
I need a good data structure collection for Unity, where can I find it?
I need it in c#.
C5 Generic Collection Library seems to be very complete, but it does not work on Unity. Any suggestion?
Have you tried to do your own? There are few examples here : http://stackoverflow.com/questions/102398/priority-queue-in-net
yes I was there before...I have already a working o(1) code I found on internet, but I was wondering if there was a good collection.
Answer by Azrapse · Oct 25, 2013 at 04:17 PM
Use System.Collections.Generic
plus System.Linq
and you'll have an awesome collection toolset that is supported in Unity.
What you miss from there that you need?
Also, what keeps you from using it in Unity if you have access to the sources of C5?
c5 does not work out of the box and it seems hard to fix.
Linq is good, but it's not a collection of data structure. I.$$anonymous$$ I need a priority queue.
Answer by adamhill · Jul 13, 2016 at 02:28 AM
C5 now works with Unity3d - https://github.com/sestoft/C5#c5-on-unity3d
Importing C5 from this link leads to a slew of errors... any particular thing one needs to do to adapt C5 for Unity?
Well, when you check the history you will notice that in February 2019 they decided to only support .NET Standard 2.0. So they officialy dropped support for any older .NET standard. Though the greatest issues is that in later commits (I guess the one from $$anonymous$$ay 7, 2019 might be the main issue) they actually solve some issues they had with the new nullable reference types and extensively used the new C# 8 feature the "null-forgiving" operator. Of course this syntax isn't supported by any compiler before C# 8. Even Unity has finally moved on from C# 3.5 / 4.0 to support C# 7, Unity does not yet support C# 8 features.
What you can do is simply use the latest commit from 2017 before they did the move to .NET standard 2.0 (direct download link) which should still work with Unity. At least I just have tried building it with VS 2017 (which came with an older Unity version) and it compiled without any issues.
Your answer
Follow this Question
Related Questions
Using HashSet in Unity 3 Answers
OrderedDictionary on Mobile 0 Answers
NativeList Empty Outside Job But Not Inside It 1 Answer
"mscorlib.dll" wrong when UnityLoadApplication() on ios? 0 Answers
How to organize challenge system? 0 Answers