why camera is freezing while loading the 3D model

I’m doing Augmented Reality image recognition project (vuforia) and loading the .obj model from server when the image is recognized. The problem is, when my target found the loading text will start to display the percentage of load and if it comes at 99% and the camera is freezing to load the model. I’m not sure why the camera is freezing. How can we load model without freeze the camera?

var objData = ObjReader.use.ConvertFileAsync (modelString, true, standardMaterial);

while (!objData.isDone) {
Debug.Log (" objData is not there");

loadingText.text = "Loading... " + (objData.progress*100).ToString("f0") + "%";
yield return loadingText.text;
//myHealth.Progress (100); // done
loadingText.enabled = false;
string modelName = objData.gameObjects [0].name;

model = GameObject.Find (modelName); // find the model reference

model.name = targetIDModel; // change the model name to targetID !!!

GameObject modelClone = Instantiate( model ) as GameObject; //clone the model 

modelClone.transform.localPosition = Vector3.zero; // bring the clone to origin

modelClone.transform.parent = itbModel.gameObject.transform; // pair the clone to the instantiated image target

modelClone.transform.localScale = Vector3.one;

It freezes during load because Instantiate is sequential and takes place on the main thread. So, if the object is really big, it will take considerable time to load it and create a mesh for it, etc. Unity cannot render any frames while it does that work, too, so the camera freezes in the meantime.

The solution is to split the mesh up into a number of smaller meshes and load them one by one across several frames, such that frames are still rendered in between, user input still processed, etc.

You can still use Mesh.CombineMeshes to combine the loaded objects into one big mesh afterwards, if you really need them to be (though chances are you don’t).