13 / 16
Packages/2D Destruction Pro/Runtime API reference
DEVELOPER REFERENCE
13 / 16

Runtime API reference

Choose line, segment or path cuts and inspect detailed success/failure results.

English guideSource: Unity 6000.3.13f1 · Optional Jobs / BurstWeb edition · 21 October 2026

Choose the cut primitive#

RequestGeometry behavior
SliceLine / SliceLineDetailedAn infinite straight line.
SliceSegment / SliceSegmentDetailedA finite segment that must cross both sides of a piece.
SlicePath / SlicePathDetailedAn ordered sequence of straight segments, rather than a curved boolean cut.

The simple methods provide status/split counts. Use a Detailed variant when gameplay needs fragment metadata, positions or failure information.

All endpoints must be in the intended world-space positions. A finite segment that starts or ends inside a piece may not cross both boundaries; use suitable outside endpoints, or use a line when an infinite cut matches your design.

Inspect a detailed result#

The guide supplies this contextual example. target, start and end are references/positions from your own gameplay component; this is not a complete standalone script.

C#
RuntimeSliceResult result = target.SliceSegmentDetailed(start, end, force: 2f);
if (!result.Success)
{
    Debug.Log(result.Failure + ": " + result.Reason);
    return;
}

foreach (RuntimeFragmentInfo f in result.Fragments)
{
    if (f.OriginalRatio < 0.25f) { /* game-specific rule */ }
    Debug.Log($"{f.FragmentId} parent={f.ParentFragmentId}, generation={f.Generation}");
}

Result and fragment fields#

TypeExposed information described in the guide
RuntimeSliceResultSuccess, SourceObject, OriginalSourceId, cut positions/direction, LineStart, LineEnd, IsFiniteSegment, Failure, Reason and new Fragments.
RuntimeFragmentInfoFragment, IDs, OriginalRatio, ParentRatio, Area, Bounds and Generation.
LastRuntimeSliceResultInspect the last result when diagnosing a rejected request.
TryGetRuntimeFragment / TryGetParentResolve active fragments and current-cycle ancestry.

Detailed cut positions include world CutPosition, source-local LocalPosition and NormalizedSpritePosition. Read ratios and ancestry before treating these values as gameplay scores.

Respect fragment lifetime#

Handles refer to active pooled pieces. They become invalid when those pieces retire, and reassembly clears their prior ancestry. Subscribe to slice and reassembly events for lifecycle-aware gameplay and discard stale references.

The supplied PDF gives API fragments rather than complete class/namespace declarations for these examples. Consult the package's own Documentation/Runtime-Slicing.md for project-level integration details.

Adapted from the supplied guide · PDF pages 21, 25.View source guide ↗
Keep creating.ERAGAN STUDIO.

Search a topic, setting or method across all package guides.