See here, c# code version :
i = 0;
should be
int i = 0;
CombineInstance[] combine = new CombineInstance[meshFilters.length];
should be
CombineInstance[] combine = new CombineInstance[meshFilters.Length];
while (i < meshFilters.length) {
should be
while (i < meshFilters.Length) {
and still having errors :
Type `UnityEngine.Component' does not contain a definition for `sharedMesh' and no extension method `sharedMesh' of type `UnityEngine.Component' could be found (are you missing a using directive or an assembly reference?)
Please replace the wrong c# code from the documentation by :
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(MeshFilter))]
[RequireComponent(typeof(MeshRenderer))]
public class example : MonoBehaviour
{
void Start()
{
MeshFilter[] meshFilters = GetComponentsInChildren<MeshFilter>();
CombineInstance[] combine = new CombineInstance[meshFilters.Length];
int i = 0;
while (i < meshFilters.Length)
{
combine[i].mesh = meshFilters[i].mesh;
combine[i].transform = meshFilters[i].transform.localToWorldMatrix;
meshFilters[i].gameObject.active = false;
i++;
}
transform.GetComponent<MeshFilter>().mesh = new Mesh();
transform.GetComponent<MeshFilter>().mesh.CombineMeshes(combine);
transform.gameObject.active = true;
}
}