Я отправляю запрос на получение, и иногда он возвращает ответ, а иногда нет, и я не понимаю, почему, но даже когда он возвращается, он выдает ошибку ArgumentNullException: Value cannot be null.
Parameter name: input
Мой запрос на получение:
private string response;
IEnumerator GetRequest(string uri)
{
using (UnityWebRequest webRequest = UnityWebRequest.Get(Host + uri))
{
yield return webRequest.SendWebRequest();
response = webRequest.downloadHandler.text;
}
}
public int GetID(string entity, string identify, string ID)
{
int id = 0;
StartCoroutine(GetRequest(entity + identify));
var json = ParseJson(response);
try
{
id = int.Parse(json[ID]);
}
catch (Exception) { }
return id;
}