Argument out of range exception???
I'm stuck with this error. So far my code is functioning properly in terms of retrieving the data but the "argumentoutofrangeexception: argument is out of range Parameter name: index" keep appearing. Any help would be really appreciated.
public string[] items;
IEnumerator Start () {
WWW itemsData = new WWW ("http://localhost/Data/sendDataInfo.php");
yield return itemsData;
string itemsDataString = itemsData.text;
items = itemsDataString.Split(';');
for (int i = 0; i < items.Length ; i++)
{
Debug.Log(GetDataValue(items[i], "condition:"));
}
}
string GetDataValue (string _data, string _index) {
string value = _data.Substring(_data.IndexOf(_index) + _index.Length);
if (value.Contains ("|")) {
value = value.Remove (value.IndexOf ("|"));
}
return value;
}
Some of the strings in "items" must be too short for the Substring input. Try setting a breakpoint on your for-loop and checking the contents of the "items" container before it's sent to GetDataValue.
Your answer
Follow this Question
Related Questions
Does anyone understand why I keep getting "ArgumentOutOfRangeException" from my code? 0 Answers
ArgumentOutOfRangeException: Argument is out of range. -> Index 2 Answers
Building For IOS on a Mac Error: UnauthorizedAccessException: Access to path is denied. 0 Answers
problem with stackoverflow exception 2 Answers