diff --git a/Runtime/ChunkGraph/ChunkNode.cs b/Runtime/ChunkGraph/ChunkNode.cs index 67a1cc7..b70ab57 100644 --- a/Runtime/ChunkGraph/ChunkNode.cs +++ b/Runtime/ChunkGraph/ChunkNode.cs @@ -264,17 +264,18 @@ private void OnDrawGizmos() var connectionsCount = connections.Count; if (connectionsCount == 0) return; - var points = new Vector3[2* connectionsCount]; + var points = new Vector3[2 * connectionsCount]; int i = 0; + Gizmos.color = Color.blue; foreach(var connectedNode in connections.Keys) { var otherCenterOfMass = connectedNode.Rigidbody.worldCenterOfMass; points[i++] = centerOfMass; points[i++] = otherCenterOfMass; - } - Gizmos.color = Color.blue; - Gizmos.DrawLineList(points); + //Draw gizmo line for connections + Gizmos.DrawLine(points[i], points[i++]); + } } #endregion diff --git a/Runtime/LibreFracture.cs b/Runtime/LibreFracture.cs index 3819d48..da269b0 100644 --- a/Runtime/LibreFracture.cs +++ b/Runtime/LibreFracture.cs @@ -1,5 +1,4 @@ using UnityEngine; -using Unity.VisualScripting; using NvBlast; @@ -162,7 +161,7 @@ public static GameObject FinalizeFracturedPreview(GameObject fracturedObject, Fr chunkDistancePreview.UpdatePreview(0); GameObject.DestroyImmediate(chunkDistancePreview); } - chunk.GetOrAddComponent(); + chunk.gameObject.AddComponent(); CreateColliderForChunk(chunk.gameObject); } @@ -173,7 +172,8 @@ public static GameObject FinalizeFracturedPreview(GameObject fracturedObject, Fr if(!fracturedObject.TryGetComponent(out _)) fracturedObject.AddComponent(); - var fracture = fracturedObject.GetOrAddComponent(); + var fracture = fracturedObject.GetComponent(); + if (fracture == null) fracture = fracturedObject.AddComponent(); fracture.jointBreakForce = parameters.jointBreakForce; fracture.totalMass = parameters.totalObjectMass;