Reproducing "SQL tables" in C# Classes

Hi All,

I’ve got a set of classes City, Country, Border.

Each class has references to each other:

  • City references the parent Country
  • Country references the cities contained via List
  • Country references other bordering countries via List
  • Country references a Border class, shared between 2 Country instances

Problem is that I believe that this is causing the Unity Scene loading to slow down.

Unity occasionally crashes giving me a “low on memory” error.


EDIT Unity crashes with low memory even if the class instances aren’t created.


Anyone have an idea?

Hope someone can help! Thanks! :slight_smile:


EDIT 2: This is caused by the inspector. Making the variables private doesn’t help…

That object relation setup can’t be the reason for low performance or errors. It looks like a very valid design.

I’m sure you have bugs in your code causing it to crash.