I used this code:
if(Physics2D.Linecast(start,end,layerMask)){
//SOME CODE
}
also used this:
RaycastHit2D hit = Physics2D.Linecast(start,end,layerMask);
Both of them are working, how is this possible??? How can the same method return different type of object?
Thanks.