/// <summary> /// Destroys the internal collider representation. /// </summary> private void DestroyNative() { if (parent != null) { parent.RemoveCollider(this); } parent = null; if (native != null) { native.Destroy(); native = null; } }
/// <summary> /// Creates the internal representation of the Collider and restores the values saved by the Component. /// </summary> private void RestoreNative() { native = CreateCollider(); native.Component = this; native.Position = serializableData.localPosition; native.Rotation = serializableData.localRotation; native.IsTrigger = serializableData.isTrigger; native.Mass = serializableData.mass; native.Material = serializableData.material; native.ContactOffset = serializableData.contactOffset; native.RestOffset = serializableData.restOffset; native.Layer = serializableData.layer; UpdateParentRigidbody(); UpdateTransform(); UpdateCollisionReportMode(); }
/// <summary> /// Converts an array of native colliders to collider components. /// </summary> /// <param name="colliders">Native colliders.</param> /// <returns>Managed collider components.</returns> private static Collider[] ConvertColliders(NativeCollider[] colliders) { Collider[] output = new Collider[colliders.Length]; for (int i = 0; i < colliders.Length; i++) output[i] = colliders[i].Component; return output; }
/// <summary> /// Destroys the internal collider representation. /// </summary> private void DestroyNative() { if (parent != null) parent.RemoveCollider(this); parent = null; if (native != null) { native.Destroy(); native = null; } }