Raycasting not working with procedural terrain

I’m sure this is some simple error somewhere on my part, but I’ve been working for a while to fix this without success. I’ve created a simple mesh-generator for a tycoon-esque game’s terrain, where there are multiple chunks of course, each comprised of a single mesh. Updating the mesh has worked out fine, as well as rendering it, but for some reason, the Collider seems not to work with a simple Raycast from the Camera. My with this raycast intention was to allow basic terraforming, and here’s some of the code:

if (Input.GetMouseButtonDown(0)) {
		var hit : RaycastHit;
		if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition),hit,1000)) {
			print("Clicked a Collider");

This is called in the Update of the Camera, and ChangeHeight is a working function that is exactly what it sounds like. The “terrain” is less that 500 units away from the Camera. In the Terrain Chunk Start function:

GetComponent.<MeshCollider>().sharedMesh	= GetComponent.<MeshFilter>().mesh;

…and it’s Update…

if (hasChanged) {
		GetComponent.<MeshCollider>().sharedMesh = GetComponent.<MeshFilter>().mesh;

Thanks in advance- I’m sure this is some careless oversight on my part, I just can’t seem to find what it is.

So, I seem to have figured out a way to solve this in part, but it seems a little pointless, and that there should be a better way. If I replace sharedMesh.Clear() with sharedMesh = new Mesh(); it works fine (save the inevitable lag). Anyone know why this is?

I hate to answer my own question, but it seems like the most effective way to do this is by setting the mesh of the collider to null, then replacing it with the desired mesh. I hope this is as the person who so kindly answered my question first (to have his answer removed by himself or something else), fixed in upcoming Unity patches.