Physics2D.Raycast has no out hitinfo?

Hello everyone!
Is there a specific reason why Physics2D.Raycast doesn’t have out hitinfo?
For example, how should I check for any tags on Objects that are hit?

Greetings,
Shu

It returns it, rather than returning a bool like Physics.Raycast does.

RaycastHit2D hit = Physics2D.Raycast(transform.position, -Vector2.up);

if(hit.collider != null)
{
    // hit something
}
1 Like

Thank you very much! This makes perfect sense now!