UnityWebRequest metadata


We could grab things like file size, last-modified timestamp etc, even before downloading the the file.

HTTP Header reference

//We could grab things like file size, last-modified timestamp etc, even before downloading the the file. 
#if UNITY_2017_1_OR_NEWER
 UnityWebRequest request = UnityWebRequestTexture.GetTexture(url);
#else
 UnityWebRequest request = UnityWebRequest.GetTexture(url);
#endif
 request.method = "HEAD";
 yield return request.Send();
 bool requestHadError;

#if UNITY_2017_1_OR_NEWER
 requestHadError = request.isNetworkError;
#else
 requestHadError = request.isError;
#endif
if (!requestHadError)
{
 double uploadedTimeStamp = MoreAppsUtils.GetUnixTimestamp(request.GetResponseHeader("Last-Modified"));
}
request.Dispose();
request = null;