In my game, I am saving a class Map which has a
A Region has the following information:
Code: Select all
- RegionID (int)
- RegionPositions (HashSet<Vector3Int)
- RegionRect (Rect)
I can save, load and use this without any problems. The problem occurs when a Region needs to save one more piece of information. I need every region to store a reference to all the regions that are is neighbors, and I do this here:
When I include that field to be saved through the ES3 "Types" tab, and try to save, the whole editor and game freeze and nothing happens. I have to kill unity with the task manager to get back in. So it seems a Region cannot save Regions.
Saving a Region's neighbors inside of itself is crucial for me, and I would like to do it this way for simplicity. What is the issue here and how can I fix this?