fix: error when multiple gameobjects have the same path (#957)

This commit is contained in:
bd_ 2024-08-06 20:43:55 -07:00 committed by GitHub
parent c2f37bb3a1
commit 1c766e9fe8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -308,8 +308,13 @@ namespace nadena.dev.modular_avatar.animation
{
if (_pathToObject == null)
{
_pathToObject = _objectToOriginalPaths.SelectMany(kvp => kvp.Value.Select(p => (p, kvp.Key)))
.ToImmutableDictionary(t => t.p, t => t.Key);
var builder = ImmutableDictionary.CreateBuilder<string, GameObject>();
foreach (var kvp in _objectToOriginalPaths)
foreach (var p in kvp.Value)
builder[p] = kvp.Key;
_pathToObject = builder.ToImmutable();
}
if (_pathToObject.TryGetValue(path, out var obj))