Prevent other thread from changing collection /multithreading)

This commit is contained in:
glax 2023-04-21 18:34:49 +02:00
parent d8ce6e4ce5
commit 914731c8a3

View File

@ -29,6 +29,8 @@ namespace Pathfinding
Region? loadedRegion = RegionFromId(id);
if(_regions.TryGetValue(id, out Region? retRegion2)) //Prevent other thread from changing collection
return retRegion2;
if(loadedRegion is not null)
_regions.TryAdd(loadedRegion.regionHash, loadedRegion);