Combining Children into 1 Mesh + Collider

Hey,
So I’m trying to combine the child objects of an empty parent game object into 1 mesh, then apply a mesh collider.

I’m using the code below… The issue is that on line “var meshFilters : MeshFilter[ ] = GetComponentsInChildren(MeshFilter);” it springs up an error at runtime saying:

“InvalidCastException: Cannot cast from source type to destination type.
CombineMesh.Start () (at Assets/GameScripts/CombineMesh.js:17)”

Can anyone see something I’m doing wrong? I’m building for iOS*

Thanks in advance!

  • Adam Green

http://subversion.assembla.com/svn/struckByThunder/trunk/Assets/Antares/Scripts/CombineChildrenExtanded.cs