Skip to content

Physics2DCast

Aprius edited this page Jan 16, 2025 · 1 revision

Simple shortcut for Physics2D cast non alloc

  • RaycastNonAlloc
  • LinecastNonAlloc
  • BoxCastNonAlloc
  • CapsuleCastNonAlloc
  • OverlapBoxNonAlloc
  • CircleCastNonAlloc
  • OverlapAreaNonAlloc
  • OverlapCapsuleNonAlloc
  • OverlapCircleNonAlloc
  • OverlapPointNonAlloc

Simple

  • RaycastNonAlloc

It's similar to Physics2D.RaycastNonAlloc but you don't need to worry about initializing RaycastHit2D[] for results anymore

public DynamicArray<RaycastHit2D> results = new();


Physics2DCast.v(transform.position, Vector2.right, results);
Clone this wiki locally