- Home /
Using a method to get the string from a download.
Hello, I have been trying to create a method that gets the characters names from a user in the data base. I created the method: string charlist(float charc) that gets the characters local id (from 1 to 3). (People can hold only 3 characters with their users). The method gets the information sends the url and checks if the download is done but as long as it runs only once it checks only ones and it doesnt gets me the strings name back. It uses if(WWW.isDone). Is there a way to get an IEnumerator called by coroutine to return back a string? Because it did not work to me.
Please help me out!
Answer by alexc1995 · May 07, 2012 at 11:01 AM
I had problems with this last night and it took me a long time to think about my code. Think logical about your code, Ienumerator's cant return data.
The way I did it was to have a player list. When I called the Ienumerator, I sent 3 variables: AuthCode, Player class instance and url. Once I had fetched the WWW, I accessed another function which took the player class variable and response. This way, you have a reference to which player you want to allocate the information to and also the response data, all in its own little function.
Hope this helps!
Answer by benk0913 · May 07, 2012 at 11:20 AM
Hmmm. I dont see how this helps.. but thank you anyways. Its propably because we try to achive different goals.
Answer by benk0913 · May 08, 2012 at 07:42 PM
Hmmmm... Can you please post the other function that shows grabs the information?