RoadRunner/Assets/Gley/About/Editor/EditorFileLoader.cs
2024-11-19 11:48:21 +01:00

43 lines
860 B
C#

namespace Gley.About
{
using UnityEngine;
#if UNITY_2018_3_OR_NEWER
using UnityEngine.Networking;
#endif
public class EditorFileLoaded
{
#if UNITY_2018_3_OR_NEWER
UnityWebRequest www;
#else
WWW www;
#endif
public void LoadFile(string url)
{
#if UNITY_2018_3_OR_NEWER
www = UnityWebRequest.Get(url);
www.SendWebRequest();
#else
www = new WWW(url);
#endif
}
public bool IsDone()
{
return www.isDone;
}
public string GetResult()
{
if (string.IsNullOrEmpty(www.error))
{
#if UNITY_2018_3_OR_NEWER
return www.downloadHandler.text;
#else
return www.text;
#endif
}
return null;
}
}
}