Problem is not reproducible or outdated
Memory problem on android/ios 1GB ram with string[]?
Hi, I've been working on a new app for both android and IOs, and I've encountered a big problem to mi app, on the register i'm using the UI, but when i instantiate the some buttons, the text on the button disappears after the halve of the list, it only happens on devices with 1Gb of ram. It could be a memory leak? how can i solve that?
here is my related code:
//provincias
private string[] provincias ={"Álava","Albacete","Alicante(Alacant)","Almería","Asturias","Ávila","Badajoz","Barcelona","Burgos","Cáceres","Cádiz","Cantabria","Castellón(Castelló)","Ceuta","Ciudad Real","Córdoba","Cuenca","Gerona (Girona)","Granada","Guadalajara","Guipúzcoa","Huelva","Huesca","Islas Baleares (Illes Balears)","Jaén","La Coruña (A Coruña)","La Rioja","Las Palmas","León","Lérida (Lleida)","Lugo","Madrid","Málaga","Melilla","Murcia","Navarra","Orense (Ourense)","Palencia","Pontevedra","Salamanca","Santa Cruz de Tenerife","Segovia","Sevilla","Soria","Tarragona","Teruel","Toledo","Valencia (Valéncia)","Valladolid","Vizcaya","Zamora","Zaragoza "};
private int[] codigoProvincia = {1 ,2 ,3 ,4 ,33,5 ,6 ,8 ,9 ,10,11,39,12,51,13,14,16,17,18,19,20,21,22,7 ,23,15,26,35,24,25,27,28,29,52,30,31,32,34,36,37,38,40,41,42,43,44,45,46,47,48,49,50};
public void SeleccionaProvincia(){
panelFondo.SetActive(true);
panelProvincia.SetActive(true);
//Provincias provincias;
for (int i =0; i<provincias.Length;i++){
GameObject opcionProvincia = (GameObject)Instantiate(textoProvincia);
opcionProvincia.GetComponentInChildren<Text>().text = provincias[i];
string nombre = provincias[i];
int codigo = codigoProvincia[i];
opcionProvincia.GetComponent<Button>().onClick.AddListener(
() => {SaveCity (codigo,nombre);}
);
opcionProvincia.transform.SetParent (panelProvincia.transform,false);
}
panelProvincia.SetActive(true);
}
Thanks in Advance, and sorry for my poor English.
Follow this Question
Related Questions
how to connect my Health to my UI 1 Answer
Error CS1061: Are you missing an assembly reference? 2 Answers
How can I make a UI button press affect something in a text box? 0 Answers
Application.LoadLevel is not destroying anything 1 Answer
How to show and remove text before player has started the game? 1 Answer