fix: build fails when entries in the bones array are null (#682)

* fix: build fails when entries in the bones array are null

* chore: skip bone remapping when no Scale Adjusters are in use
This commit is contained in:
bd_ 2024-02-19 17:27:36 +09:00 committed by GitHub
parent f6a2da8b8d
commit d26ac60be5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -33,12 +33,17 @@ namespace nadena.dev.modular_avatar.core.editor
UnityEngine.Object.DestroyImmediate(sar.gameObject);
}
if (boneMappings.Count == 0)
{
return;
}
foreach (var smr in context.AvatarRootObject.GetComponentsInChildren<SkinnedMeshRenderer>())
{
var bones = smr.bones;
for (int i = 0; i < bones.Length; i++)
{
if (boneMappings.TryGetValue(bones[i], out var newBone))
if (bones[i] != null && boneMappings.TryGetValue(bones[i], out var newBone))
{
bones[i] = newBone;
}