diff --git a/Runtime/Scripts/Fracture.cs b/Runtime/Scripts/Fracture.cs index 8190676..1fe5248 100644 --- a/Runtime/Scripts/Fracture.cs +++ b/Runtime/Scripts/Fracture.cs @@ -207,6 +207,10 @@ private GameObject CreateFragmentTemplate() obj.name = "Fragment"; obj.tag = this.tag; + if (fractureOptions.shouldInheritLayer) + { + obj.layer = gameObject.layer; + } // Update mesh to the new sliced mesh obj.AddComponent(); diff --git a/Runtime/Scripts/Options/FractureOptions.cs b/Runtime/Scripts/Options/FractureOptions.cs index fec7b7d..5236695 100644 --- a/Runtime/Scripts/Options/FractureOptions.cs +++ b/Runtime/Scripts/Options/FractureOptions.cs @@ -28,13 +28,15 @@ public class FractureOptions [Tooltip("The material to use for the inside faces")] public Material insideMaterial; - + [Tooltip("Scale factor to apply to texture coordinates")] public Vector2 textureScale; [Tooltip("Offset to apply to texture coordinates")] public Vector2 textureOffset; + [Tooltip("Inherits the layer of the original gameobject")] + public bool shouldInheritLayer; public FractureOptions() { this.fragmentCount = 10; @@ -46,5 +48,6 @@ public FractureOptions() this.insideMaterial = null; this.textureScale = Vector2.one; this.textureOffset = Vector2.zero; + this.shouldInheritLayer = true; } } \ No newline at end of file