Unity3D rigidbody shots

I got a problem with my gun, when I’m firing my shots (which has a rigidbody on them) they sometimes go through the walls, and Im wondering if it’s possible to stop that somehow? That they collide with everything that has a collider on it.

try to use Rigidbody.MovePosition instead of changing transform.position: