The Legend of the waiting for function to end! Still no answer for that, Please Help
Hello friends!, unity is sooooo wonderful !, i love you unity! BUT i am having a problem! i have a function:
public function TestePegarLista() {
var pathToPHP = PHP_Lista;
var finalizou: boolean = false;
var w : WWW = new WWW( pathToPHP ); //
yield w;
atualizando = "Informacoes Recebidas, Processando";
if (w.error != null)
{
atualizando = "Falha de Comunicacao?";
}
else
{
pro_ean = new List.<String>();
pro_dc = new List.<String>();
pro_pre_ven = new List.<String>();
var args : String[] = w.text.Split(":"[0]);
if (args[0] != "0")
{
registros_total = args.length;
registros_atual = 0;
return;
}
for (var i = 1; i < args.length; i++)
{
var fields : String[] = args[i].Split("="[0]);
pro_ean.Add(fields[0]);
pro_dc.Add(fields[1]);
pro_pre_ven.Add(fields[2]);
registros_atual = registros_atual + 1;
}
}
}
So, I try something like
function ButtonClick() {
TestePegarLista();
if( registros_total != 0 ) { Here I can fill any var or clone buttons for example, BUT it dont wait for the LOOP FUNCTION of the other function to END !, it returns registros_total = 0!!!!! i must to double run the function to make it works, its not waiting for the TestePegarLista to end to start processing the nex step, please folks how its possible to make it works ?
Many thanks
}
}
Answer by angelodelvecchio · Jan 14, 2016 at 07:38 PM
This mean, i will not for example, be able to make an array system, and a function to locate data ?
like
code : List. = new List.(); description : List. = new List.();
function LocateByDescription( Desc: String ) {
for (var i = 1; i < managerDatabaseScript.description .Count; i++) {
if( managerDatabaseScript.code [ i ] == Desc)
{
return i;
}
}
}
Because i cant wait for the function to do it ? Please help!
Your answer
![](https://koobas.hobune.stream/wayback/20220612060021im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Difference between C# Invoke and Unity Invoke 0 Answers
Android plugin - how to create a daily notification 0 Answers
FBX Exporter is not responding 0 Answers