Random Get Point On Collider 2D
Gets a random world-space point on the perimeter of a 2D collider.
Supports BoxCollider2D, CircleCollider2D, CapsuleCollider2D, and EdgeCollider2D.
Other Collider2D types fall back to sampling the collider’s bounds perimeter.
Use it to place effects, objects, or particles along the edges of a shape - such as sparks on a wall, enemies around a ring, or items on a track.
Parameters
| Parameter | Description |
|---|---|
| Collider | The Collider2D component whose perimeter to sample. |
| Store Result | Vector2 variable to store the random world-space point. |
Tips
- Deterministic results: Use Random Init State before running this action if you need reproducible results.
- EdgeCollider2D: Ideal for custom outlines such as paths or irregular shapes.
- Non-uniform scaling: Circles use the largest axis scale to stay on the actual circle edge.
- Use with spawners: Works well for spawning FX or collectibles around a collider border.
Common Pitfalls
- No Collider set: The action does nothing if Collider is not assigned.
- EdgeCollider2D requires points: Must have at least two points; otherwise logs a warning.
- Capsule with zero length: Behaves like a circle collider.
- Unsupported colliders: Polygon or composite types use the bounds perimeter instead of the exact outline.