- Home /
www.data to array
I have
if (www.error == null)
{
Debug.Log("WWW Ok!: " + www.data);
} else {
Debug.Log("WWW Error: "+ www.error);
}
How to make this www.data value into array in c#?
Answer by Mexallon · May 13, 2013 at 06:53 AM
Hej there. Depends on what kind of data you want to read. For binary like this.
byte[] data;
if (www.error != null)
{
Debug.Log("WWW Error: "+ www.error);
} else {
data = www.byte;
}
wha i sthis. i wanted to make string www.data into a array
Couldnt read that out of your question. If you want the data as a string you can simply use
string s = www.text;
This really depends on what data are you reading. If the data contains some values that are seperated by a special char you can use a while loop and string.split to add those values to the array. Though i would recommend a List. You can use it just like an array
using System.Collections.Generic;
List<string> myList;
myList.Add("String");
Debug.Log("This is the first value: " + myList[0]);
Your answer

Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
TextField Query 1 Answer
Why do I have to call ToString() when fetching a String from another script? 2 Answers
Combining several strings into a single one? 1 Answer
How to tell if a string contains some specified text 6 Answers