From 65e3c3e41add10d206274122b65cdc3f93e667c8 Mon Sep 17 00:00:00 2001 From: danno Date: Mon, 23 Jan 2023 18:11:06 +0900 Subject: [PATCH] Fixed concurrent access error at glTFExtensions::IsGeneratedUniGLTFAndOlder. --- Assets/UniGLTF/Runtime/Extensions/glTFExtensions.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Assets/UniGLTF/Runtime/Extensions/glTFExtensions.cs b/Assets/UniGLTF/Runtime/Extensions/glTFExtensions.cs index fce7d3dca..ba1966d22 100644 --- a/Assets/UniGLTF/Runtime/Extensions/glTFExtensions.cs +++ b/Assets/UniGLTF/Runtime/Extensions/glTFExtensions.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using UnityEngine; using System.IO; using UniJSON; +using System.Collections.Concurrent; namespace UniGLTF { @@ -135,7 +136,7 @@ namespace UniGLTF } } - static Dictionary<(string, int, int), bool> s_cache = new Dictionary<(string, int, int), bool>(); + static ConcurrentDictionary<(string, int, int), bool> s_cache = new ConcurrentDictionary<(string, int, int), bool>(); public static bool IsGeneratedUniGLTFAndOlder(this glTF gltf, int major, int minor) { @@ -149,7 +150,7 @@ namespace UniGLTF } var result = IsGeneratedUniGLTFAndOlderThan(gltf.asset.generator, major, minor); - s_cache.Add(key, result); + s_cache[key] = result; return result; } }