GetPhysicsOutline
Gets a physics outline from the Sprite by its index.
Read time 1 minuteLast updated 4 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.CoreModule
GetPhysicsOutline(int, List<Vector2>)
Gets a physics outline from the Sprite by its index.
public int GetPhysicsOutline(int outlineIndex, List<Vector2> physicsOutline)
Parameters
The index of the physics outline to retrieve.
An ordered list of the points in the selected physics outline to store points in.
Returns
Type | Description |
|---|---|
| int | The number of points stored in the given list. |
Remarks
A physics outline is a cyclic sequence of line segments between points that define the outline of the Sprite used for physics. Since the Sprite can have holes and discontinuous parts, it can be made up of more than one physics outline.
GetPhysicsOutline(int)
Gets a physics outline from the Sprite by its index.
public ReadOnlySpan<Vector2> GetPhysicsOutline(int outlineIndex)
Parameters
The index of the physics outline to retrieve.
Returns
Type | Description |
|---|---|
| ReadOnlySpan<Vector2> | The physics outline as a span of vertices. It is recommended that you immediately extract what information you need and not directly reference the returned data as any subsequent change to the physics outline(s) could result in a crash when iterating the span. |
Remarks
A physics outline is a cyclic sequence of line segments between points that define the outline of the Sprite used for physics. Since the Sprite can have holes and discontinuous parts, it can be made up of more than one physics outline.