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#?

1 Answer

1

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;

–

how to change that s into array?

–

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]);

–