I Created an Text array and selected the text objects from inspector.
When selecting the text for each object in Start function, everything works fine but when i do the same thing when pressing a button, it gives me index out of bounds.
I tried to debug and saw that if i print the array length in Update function it oscillates between 0 and the correct value.
The function giving me the index out of bounds error is:
public Text[] skinButtonText;
//other functions
public void SlectSkin(int x)
{
for(int i=0;i<skinButtonText.Length;i++)
{
skinButtonText*.text = languageScript.skins_Select;*
}
skinButtonText[x].text = languageScript.skins_Equipped;
varGlobale.skin = x;
}