You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
921 B

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
using Newtonsoft.Json;
using System.IO;
public class WebGLConfiguratiobReader
{
public string PartPath;
public string ReadResult { get; private set; }
public WebGLConfiguratiobReader(string partPath)
{
PartPath = partPath;
}
public IEnumerator ReadCoroutine()
{
string configPath = Path.Combine(Application.streamingAssetsPath, PartPath);
Debug.LogFormat("configPath {0}", configPath);
UnityWebRequest www = UnityWebRequest.Get(configPath);
yield return www.SendWebRequest();
if(www.isNetworkError || www.isHttpError)
{
Debug.Log(www.error);
}else
{
//Debug.Log(www.downloadHandler.text);
ReadResult = www.downloadHandler.text;
}
}
}