Method with optional out parameter

bool IsDestinationBlocked(Vector3 CurrentDestination, out GameObject ObjectAtDestination)

Is there a way to make the GameObject parameter optional when calling it?

if (IsDestinationBlocked(RoamTo))
{

}

No, but you can create an overload of the method:

bool IsDestinationBlocked( Vector3 CurrentDestination ) {
  return IsDestinationBlocked( CurrentDestination, out var _ );
}
2 Likes