Contains(RectTransform)
Checks whether the world-space bounding box of this RectTransform fully contains the world-space bounding box of another RectTransform.
Read time 1 minuteLast updated 6 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
public bool Contains(RectTransform other)
Parameters
The RectTransform whose world-space bounds to test against.
Returns
Type | Description |
|---|---|
| bool | True if the world-space bounding box of this RectTransform fully contains the bounding box of |
Remarks
Both bounding boxes are axis-aligned and are computed from the four world-space corners via RectTransform.GetWorldRect. Containment is inclusive on all edges, so a RectTransform returns true when tested against itself. Because world-space AABBs are used, a rotated element has an expanded bounding box; two visually overlapping elements may not satisfy containment if their AABBs differ.
Additional Resources: RectTransform.GetWorldRect.