Combine Meshes Problem


I would like to use the Combine Meshes script provided by Unity in order to optimize my game. The problem is that my parent to which I am attaching this script,after combining the meshes, it’s changing its position. I read a few answered questions

but I couldn’t understand.

@script RequireComponent(MeshFilter)
@script RequireComponent(MeshRenderer)
function Start () {
    var meshFilters = GetComponentsInChildren(MeshFilter);
    var combine : CombineInstance[] = new CombineInstance[meshFilters.length];  
    for ( i = 0; i < meshFilters.length; i++){
        combine_.mesh = meshFilters*.sharedMesh;*_

combine_.transform = meshFilters*.transform.localToWorldMatrix;*_

meshFilters* = false;*
transform.GetComponent(MeshFilter).mesh = new Mesh();
transform.GetComponent(MeshFilter).mesh.CombineMeshes(combine); = true;

How can I cache the position before combining the meshes and then restore it as for my objects to remain untouched ?

Ok, A better way of combining meshes can be found here.

The package is called Draw Call Optimizer,it can be downloaded from Asset Store and if it has errors follow the link No overload for method "X" takes `1' arguments - Questions & Answers - Unity Discussions

You can check out my tool on the unity asset store “Poly Few” which is a complete optimization solution for Unity aimed at making high quality complex 3d scenes render efficiently. With integrated features like mesh simplification, automatic LOD generation, mesh combining and material combining, you can greatly improve the performance of your game by lowering the Polygon Count, DrawCalls and SetPass calls with a few clicks and, without the need of writing even a single line of code.