Simplify model cache setting

This commit is contained in:
Jarrod Doyle 2024-08-29 18:09:10 +01:00
parent 0b347f7745
commit 74bde133bb
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 1 additions and 9 deletions

View File

@ -33,15 +33,7 @@ public class ModelLoader
// We don't care if this is null actually, we'll still cache that it's null lol // We don't care if this is null actually, we'll still cache that it's null lol
var model = LoadModel(_pathManager, ref campaignName, modelName); var model = LoadModel(_pathManager, ref campaignName, modelName);
var key = (campaignName, modelName); _cache[(campaignName, modelName)] = model;
if (_cache.ContainsKey(key))
{
_cache[key] = model;
}
else
{
_cache.TryAdd(key, model);
}
return model == null ? model : model.Duplicate() as MeshInstance3D; return model == null ? model : model.Duplicate() as MeshInstance3D;
} }