Need help with combining meshes

I’m working on a game in which you build by planting bricks (like Legos), and am trying to make the building system as efficient as possible by grouping bricks together into large meshes (other techniques will be added later). So far, I have it set up to where you position a pre-fab brick object (modeled in Blender), and then the mesh data is referenced and combined with an existing mesh when planted.

The problem I’m having is that when the brick meshes are combined, only the bottom faces show up; the brick object does have a mesh filter set up, so it should be working. The brick also has 3 different materials applied, but I don’t think that would cause a problem.

I tried using a cube primitive instead of the brick object, and it seems to work fine:

I’m not sure why I’m having this issue when merging brick meshes. Here is the script used (written in JavaScript):

public var Brick : GameObject;
public var superShift : boolean = false;
public var offset_init : float = 0.0;

private var BricksMesh : Mesh;
private var BricksMeshGO : GameObject;

function Start()
	BricksMesh = Mesh(); = "BricksMesh";
	BricksMeshGO = new GameObject("BricksMeshGO", MeshRenderer, MeshFilter, MeshCollider);
	BricksMeshGO.GetComponent(MeshFilter).mesh = BricksMesh;
	BricksMeshGO.GetComponent(MeshCollider).sharedMesh = BricksMesh;
	BricksMeshGO.GetComponent(Renderer).material.color = Color.white;

function Update()
	var hit : RaycastHit;
	var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
	if(Physics.Raycast (ray, hit) && hit.collider != null)
		Brick.transform.position = Vector3(Mathf.Round(hit.point.x), Mathf.Round(hit.point.y + offset_init), Mathf.Round(hit.point.z));

function PlantBrick()
	var combine : CombineInstance[] = new CombineInstance[2];
	combine[0].mesh = Brick.GetComponent.<MeshFilter>().mesh;
    combine[0].transform = Brick.GetComponent.<MeshFilter>().transform.localToWorldMatrix;
	combine[1].mesh = BricksMeshGO.GetComponent.<MeshFilter>().mesh;
    combine[1].transform = BricksMeshGO.GetComponent.<MeshFilter>().transform.localToWorldMatrix;
	BricksMeshGO.GetComponent.<MeshFilter>().mesh = new Mesh();
	BricksMeshGO.GetComponent(MeshCollider).sharedMesh = BricksMeshGO.GetComponent.<MeshFilter>().sharedMesh;

I figured it out - both meshes need to have the exact same material applied; it’s working great now.