RaycastHit2D.collider not working

So I’m a beginner in Unity, and I’m stuck on this tutorial

So I made a RaycastHit2D to detect a collision, but he never mentions how to make walls able to collide. My walls have a box collider. This is what I’ve done last. (I’m stuck at 11:55)

if(hit.collider == null){
    vertex = origin + GetVectorFromAngle(angle) * viewDistance;
}else{
    vertex = hit.point;
}

Checking the video, at 12:37, he selects a wall. We can see that it doesn’t need a tag and is placed on the “Objects” layer. It also has a BoxCollider2D. Also in his video he has “UtilsClass.GetVectorFromAngle(angle)”, while you only have the “GetVectorFromAngle()”, so maybe something is not right there. He provides the project files in the video description, so maybe its a good idea to download those and compare them with your code.