Prevent other thread from changing collection /multithreading)
This commit is contained in:
parent
d8ce6e4ce5
commit
914731c8a3
@ -29,6 +29,8 @@ namespace Pathfinding
|
|||||||
|
|
||||||
Region? loadedRegion = RegionFromId(id);
|
Region? loadedRegion = RegionFromId(id);
|
||||||
|
|
||||||
|
if(_regions.TryGetValue(id, out Region? retRegion2)) //Prevent other thread from changing collection
|
||||||
|
return retRegion2;
|
||||||
if(loadedRegion is not null)
|
if(loadedRegion is not null)
|
||||||
_regions.TryAdd(loadedRegion.regionHash, loadedRegion);
|
_regions.TryAdd(loadedRegion.regionHash, loadedRegion);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user