- Home /
Question by
michael_cronai · Apr 08 at 04:24 PM ·
webgl
UnityWebRequest check if file exists, without 404
Hi I am trying to write a method which checks if a file exists in the streamingAssets folder of a WebGL build. The following does work; but produces an annoying 404 error visible in the console. Is there any way around this? thanks.
public IEnumerator CheckExists()
{
var path = Application.streamingAssetsPath + filepath;
#if UNITY_EDITOR
yield return null;
isExisting = File.Exists(path);
#else
var www = UnityWebRequest.Head(path);
yield return www.SendWebRequest();
isExisting = www.responseCode < 400;
#endif
}
Error is shown as:
HEAD http://localhost:61543/StreamingAssets/Sequence/labels/000101.json 404 (Not Found)
Comment