Files
UmaViewer/Assets/Scripts/UmaViewerDownload.cs
T
katboi01 5215cd2801 Added back api call for getting English names
removed downloaded text caching?
2022-11-08 11:21:35 +01:00

24 lines
579 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
public class UmaViewerDownload : MonoBehaviour
{
public static IEnumerator DownloadText(string url, System.Action<string> callback)
{
UnityWebRequest www = UnityWebRequest.Get(url);
yield return www.SendWebRequest();
if (www.result != UnityWebRequest.Result.Success)
{
Debug.Log(www.error);
callback("");
}
else
{
callback(www.downloadHandler.text);
}
}
}