Weird Raycasting problem.

I have a ray I want to intersect with the whole scene using Physics.raycastAll() on the default layer. depending on the direction of the ray, it may not cast against the geometry. I've verified that my ray is correct, and does intersect the collision mesh. I've also made sure both the ray and the geometry on the default layer. And finally I've tested this in a different scene with both default objects and the models from my scene that fail. In this scene everything works perfectly. In the other scene, I get back an Untagged object with null values for the transform etc. The RaycastHit[] returned by raycastAll is of length one. Again, if I take the whole scene geometry into a new scene I don't see any of these weird problems. Is there some global setting in a scene that could change the behavior of the raycast? I can't find anything in the Unity doc that would suggest this. Any suggestions on how to highlight this mystery object? The material property is null.

tl;dr Raycast not working in some instances after extensive verification of correctness. Returns object with odd properties.

Backface Culling. The scene is a cell, and we have a cell membrane and wall. They are on the default layer. When I copy the geometry over, I copy all but one of the models over. This one is not in the geometry hierachry and under the camera instead. The normals for this model face inwards so the backfaces that get culled are front facing. Somehow the ray is being cast against this, but cannot get any information about what it hit. I'm still not sure how:

A) The ray collides with this object when it is consructed from two points within the scene. It should collide with the thing it is clearly going through instead.

B) Unity cannot get any information about this object.

So, I solved my problem, but have no adequate explanation for where the problem came from in the first place yet.

For me, the problem was hitting triggerBoxes. Since the ray casts against colliders, your mystery object's flipped normals aren't going to turn off collision. Putting them on layer ignoreRaycast took care of it. Also, a hack, in your loop through the hits, just `if(H*.transform==null) continue;`

* *

For exploring this mystery object [untested] you could try fishing with `hit.collider as BoxCollider` until you get a non-null

*