Accepted answer

The answer is - as you may have expected - it depends. The LINQ-operations are usually quite fast unless you are talking millions of objects. However they will produce some garbage that has to be collected eventually. If you perform such operations every frame you may run into GC hiccups. If you run stuff not that often (e.g. only when a player places/removes a house, etc.) this approach should work fine.

If you need maximum performance you may want to have a look at the new DOTS architecture (aka. ECS) in Unity, which allows you to manage large quantities of data fast. That being said - premature optimization is the root of all evil and DOTS is quite the beast to wrap your head around.

I'd start with the LINQ queries, making sure they are not called every frame and maybe some clever caching and only bring in the big guns when I actually have a performance problem.

Related Articles