about renderer.material.mainTexture

renderer.material.mainTexture=TextureTemp;

It still remail some unknown object when I using renderer.material.mainTexture to chang texture then destroy that.

P.S. observed total objects in scene in profile-memory

before

alt text

after

alt text

If so, with the increasing of the process time, the memory consumption will increased continuously then system crash in finally .

how to solve?

renderer.material.mainTexture=TextureTemp;

and Destory object where image change finish

function Update() {
var TextureTemp:Texture;
if(image.length==0) {return false;}

if(!Stop){
	if(StartTime<=0){
		if(step<stepmax){
			step++;
		}else{
			step=0;
			if(index>=image.length){
				index=repeatStartIndex;
				if(destroyOnOver){
					Destroy(gameObject);
				}
				if(StopOnOver){
					Stop=true;
				}
				if(HideOnOver){
					gameObject.active=false;
				}
			}
			
			TextureTemp=image[index];
			renderer.material.mainTexture=TextureTemp;
			
			index++;
			
			if(destroyTime>0){
				if(nowDestroyTime<0){
					Destroy(gameObject);
				}else{
					nowDestroyTime-=Time.deltaTime;
				}
			}
			
			if(index<stepmaxa.Length){
				stepmax=stepmaxa[index];
			}				
		}
	}else{
		StartTime-=Time.deltaTime;
	}
}

}

for play image