- Home /
The index value is not starting from 0
I have 2 buttons to load the different texture images and when i press the 1st it loads the 4 images in textures and when i press the 2nd button it loads the 3 images in textures. But the problem is when i press the 1st button it loads the 4 images and when i press the 2nd it loads the images but it starting from 5th place. I can't reset the value to 0 when i press the second button.
private int clonevalue = 0;
public int i = 0;
cloneGO = Instantiate(myScrollTexture)as GameObject;
cloneGO.transform.parent = parentObject.transform;
cloneGO.transform.localPosition =new Vector3(127,30,0);
cloneGO.transform.localScale =Vector3.one;
cloneGO.name = "cloneScrollTexture"+i;
string myTexture = string.Format("{0} ", modellinksArray["imageurl"]);
string modelUrl = string.Format("{0} ", modellinksArray["modelurl"]);
i++;
myTextureObject = GameObject.Find ("cloneScrollTexture" + clonevalue);
clonevalue++;
myTextureObject.GetComponent<UITexture>().mainTexture = www1.texture;
if (myTextureObject.name == "cloneScrollTexture"+evenValues) {
myTextureObject.transform.localPosition =new Vector3(-81,30,0);
evenValues +=2;
}
if(myTextureObject.name == "cloneScrollTexture"+yevenValue){
yValue += 210;
yevenValue +=2;
}
myTextureObject.transform.localPosition -=new Vector3(0,yValue,0);
when i press the 1st button and the clone value passing to 0. So, the texture image properly loading in the 0th position but when i press the second button the clonevalue passing to number 5. so, the texture image displaying in the 5th place. So, how can i reset the clonevalue 0 when i press the 2nd button. So, that i can easily pass to 0.
Comment