Raycasting ignores moved colliders

It seems as if it isn’t possible to raycast against colliders
that has been moved earlier in the frame? I have created a
test project, download it here (turn on gizmos!).

There’s two cubes in the scene. The first one is in the imminent
raycast’s path, while the second is not. In Update() I move the
first cube out of the way, the second cube is moved into the
raycast’s path. I perform the raycasts and move the cubes back to
their original positions.

The point was that I have had some strange behaviors when it comes
to raycasting so I wanted to find out if Unity uses the current position
of colliders or if it possibly only updates colliders at the end of the frame.
Turn out it doesn’t hit either cube.

Is this intended behavior? Then it should probably be documented (maybe it is?),
as the effect can be pretty serious (all enemies should be moved after you have
done your raycasting). Has anyone else run into this problem?

Yes, I ran into this problem a couple of weeks ago. Moving colliders in Update in this case isn’t a good idea to begin with, because the physics engine operates in FixedUpdate. But yes, even with FixedUpdate it turns out that moving a collider manually doesn’t actually move the collider, instead it essentially tells the physics engine to move it, which won’t happen until the next physics frame. Which makes sense in hindsight.