diff --git a/Assets/VRM10/Runtime/IO/Vrm10Importer.cs b/Assets/VRM10/Runtime/IO/Vrm10Importer.cs index 355b1fc47..fbb241a5b 100644 --- a/Assets/VRM10/Runtime/IO/Vrm10Importer.cs +++ b/Assets/VRM10/Runtime/IO/Vrm10Importer.cs @@ -615,7 +615,17 @@ namespace UniVRM10 // に基づきデフォルト値を補う // node is required - var joint = Nodes[gltfJoint.Node.Value].gameObject.AddComponent(); + var go = Nodes[gltfJoint.Node.Value].gameObject; + var joint = go.GetComponent(); + if (joint != null) + { + // 仕様違反。マイグレーションで発生しうるのと、エクスポーターでの除外などがされていないので、 + // エラーにせずに飛ばす + Debug.LogWarning($"duplicated spring joint: {Data.TargetPath}"); + continue; + } + + joint = go.AddComponent(); joint.m_jointRadius = gltfJoint.HitRadius.GetValueOrDefault(0.0f); joint.m_dragForce = gltfJoint.DragForce.GetValueOrDefault(0.5f); joint.m_gravityDir = gltfJoint.GravityDir != null ? Vector3InvertX(gltfJoint.GravityDir) : Vector3.down;