if your project is big then you should consider using less physics (i.e. using colliders and rigidbodies to restrict player from moving through wall)
and use transform to bound the movement instead and if you still wanna use the wall to just like make a visual illusion for player i.e. to make player beleive that he is colliding with wall thats why he can’t move through it then you should just use mesh for visuals and use the same transform method to restrict the player movement when he is close enought to the wall by checking distance ofcourse.
hope it helped!!!
Read more here: Source link