Loader.js:1-Warnung: 2 FS.syncfs-Vorgänge gleichzeitig im Einsatz, wahrscheinlich nur zusätzliche Arbeit
Fehler beim Ausführen von WebGL in Google Chrome
Da es zum Laden und Deserialisieren lokaler JSON-Dateien geschrieben wurde (wie unten gezeigt), wird die obige Warnung ausgegeben
public T LoadLocalData(string path) where T : class
{
try
{
using (var sw = new StreamReader(path))
{
var json = sw.ReadToEnd();
return JsonUtility.FromJson<T>(json);
}
}
catch (System.Exception e)
{
Debug.LogError($"Error: {path} | {e.Message}");
}
return null;
}
Dateioperationen sind in WebGL nicht zulässig
public T LoadLocalData(string path) where T : class
{
#if UNITY_WEBGL
// WebGL用其他代替处理
return null;
#else
try
{
using (var sw = new StreamReader(path))
{
var json = sw.ReadToEnd();
return JsonUtility.FromJson<T>(json);
}
}
catch (System.Exception e)
{
Debug.LogError($"Error: {path} | {e.Message}");
}
return null;
#endif
}