From d26ac60be537d2f135601196100676e555b3e8a0 Mon Sep 17 00:00:00 2001 From: bd_ Date: Mon, 19 Feb 2024 17:27:36 +0900 Subject: [PATCH] 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 --- Editor/ScaleAdjusterPass.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Editor/ScaleAdjusterPass.cs b/Editor/ScaleAdjusterPass.cs index 76dd924d..cc917027 100644 --- a/Editor/ScaleAdjusterPass.cs +++ b/Editor/ScaleAdjusterPass.cs @@ -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()) { 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; }