Hey there,
I’ve got a system set up between unity/php/SQL where you can refresh and get a list of players connected to the server, which appear as a string (i.e just text)
I need the player to be able to click on these, and I’m wondering what the right way to do this is? Should I convert this string to an array, and then somehow generate gui.buttons from that array? Or is there a way to convert each line from SQL to a button?
Sorry, here’s my code:
function getUsers(){
var players=new WWWForm();
players.AddField("Users",TestInt);
var w =WWW(getURL,players);
yield w;
var returnedString=w.data;
var values=returnedString.Split(""[0]);
var playerButtons = new Array();
playerButtons = returnedString.Split();
if(values.length==2){
upTo=parseInt(values[0]);
formChat=values[1] + "\n";
scrollPosition=Vector2(0,Mathf.Infinity);
}
yield WaitForSeconds(1);
refresh();
}
[/code]