Only some of the FBX models have them and I am just trying to remove them. This is the entirety of my code. My models are in a Resources folder and I have assigned this script to an empty GameObject.
var textfile: TextAsset;
function Start () {
textfile = Resources.Load("modellocations");
var textcontents: String = textfile.text;
lines = textcontents.Split("
"[0]);
//Getting rid of extra newline at end of file
numlines = (lines.Length/3)*3;
for (i = 0; i < numlines; i+=3) {
var name = lines*;*
*var xcoord = lines[i+1];*
*var zcoord = lines[i+2];*
*var searchstr = "Google_Earth_Terrain/Mesh1";*
*var googmesh: GameObject;*
*var temp : GameObject = Resources.Load(name, typeof(GameObject)) as GameObject;*
*if (temp == null) {*
*print (name +" failed to import");*
*continue;*
*}*
*temp.AddComponent(MeshRenderer);*
*clonesq = Instantiate(temp, Vector3(parseFloat(xcoord),0,parseFloat(zcoord)), Quaternion.identity);*
*clonesq.name = name;*
*googmesh = clonesq.Find(searchstr);*
*if (googmesh) {*
*Destroy(googmesh);*
*}*
*}*
*camera.main.transform.position = Vector3(332,0,3221);*
*}*
*```*
*<p>Ignore what I do from the text file, that is just some placement information. I added the MeshRenderer component, otherwise the objects wouldn't show. Now I find and store the item I want to delete in googmesh. I then destroy it (I had some print messages before Destroy, so I knew that it was finding things). The weird part is that only the first such FBX model with a googmesh had it deleted. It wouldn't do it for other objects even though this is in a loop. Any help or another way of solving the problem would be highly appreciated.</p>*