0

How to sort gameobject lists by object variables

KubaBaku 2 years ago updated 2 years ago 3

This maybe a dumbss question...

As the title mentioned, I tried to generate a custom unit by scripting using System.Linq without inheriting any classes like MonoBehaviour to sort and return a List of GameObjects. It worked before but all the methods of the class I wrote disappeared after I modified the class, no matter regeneratng the unit or making a new class containing the same method...

Or is there any ways to sort by Bolt flow directly?

Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):

Or is System.Linq cannot be used like this? Sorry for bothering you...

If it worked before, then it will now. No need to change your code, except the fact you probably changed the name of a method or class? If so you will want to use [RenamedFrom(string)] attribute above any of those that changed. As soon as it compiles and recognizes that it once used the old name, it will reappear. Might need to regenerate units, but this is how you prevent that in the future. 

Thanks for your tips JasonJonesLASM, I never use this attribute before, although it's still not working after adding the attribute...
Maybe the problem is that we cannot return a List? I'm not sure but my methods appear after modifying the return type from List<GameObject> to GameObject[].
I have no idea what's happening (tearsofjoy) anyway thanks for your reply!