From 6018af0a4e15ccf78d861bd19ca2da0813d18cf3 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Fri, 29 Nov 2024 03:58:24 +0900 Subject: [PATCH] fix ClothWarpRoot.OnValidate --- .../ClothWarp/Runtime/Components/ClothWarpRoot.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Assets/VRM10_Samples/ClothSample/ClothWarp/Runtime/Components/ClothWarpRoot.cs b/Assets/VRM10_Samples/ClothSample/ClothWarp/Runtime/Components/ClothWarpRoot.cs index fa3b708c0..456a8c3a8 100644 --- a/Assets/VRM10_Samples/ClothSample/ClothWarp/Runtime/Components/ClothWarpRoot.cs +++ b/Assets/VRM10_Samples/ClothSample/ClothWarp/Runtime/Components/ClothWarpRoot.cs @@ -4,7 +4,6 @@ using System.Linq; using UniGLTF.SpringBoneJobs.Blittables; using UnityEngine; using UnityEngine.UIElements; -using UniVRM10; namespace UniVRM10.ClothWarp.Components @@ -100,7 +99,18 @@ namespace UniVRM10.ClothWarp.Components void OnValidate() { - m_particles = GetComponentsInChildren().Skip(1).Select(x => new Particle(x)).ToList(); + var backup = m_particles.ToDictionary(x => x.Transform, x => x); + m_particles = GetComponentsInChildren().Skip(1).Select(x => + { + foreach (var particle in m_particles) + { + if (particle.Transform == x) + { + return particle; + } + } + return new Particle(x); + }).ToList(); m_map.Clear(); for (int i = 0; i < m_particles.Count; ++i) {