Uninomicon

Documenting the dark corners of the Unity Engine.

User Tools

Site Tools


unitywebrequest

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
unitywebrequest [2021/05/28 20:37]
gwenpri.me slashes
unitywebrequest [2022/01/28 17:29] (current)
73.217.35.3
Line 1: Line 1:
 ====== UnityWebRequest ====== ====== UnityWebRequest ======
  
 +==== Local Filesystem Requests ====
 When using UnityWebRequest to load from the local filesystem: When using UnityWebRequest to load from the local filesystem:
  
   * macOS and iOS require that ''file:⁄⁄'' be prepended to the location.   * macOS and iOS require that ''file:⁄⁄'' be prepended to the location.
-  * Android **must not** have this +  * Android **must not** have ''file:⁄⁄'' prepended. 
-  * Windows do not require this, but will tolerate it. +  * Windows does not require ''file:⁄⁄'', but will tolerate it. 
-  * Other targets are untested.+ 
 +==== Sending requests during destruction ==== 
 + 
 +To ensure that UnityWebRequest operations are completed even if the MonoBehaviour is being destroyed (e.g. when the game is exiting), it appears to be safe on at least some platforms (such as Windows) to manually wait in a loop inside ''OnDestroy'' for ''isDone == true'' on the ''[UnityWebRequest]AsyncOperation'' object returned by ''Send[WebRequest]''
 + 
 +  * Note however that mobile platforms don't provide destruction callbacks at all and will usually simply kill the process. 
 +  * It is recommended to limit the maximum running time of such a loop, and an appropriate time measurement method like ''System.Diagnostics.Stopwatch'' should be used for that since ''Time'' properties will not be updated and ''DateTime.UtcNow'' output can be changed by the user/system.
unitywebrequest.1622234270.txt.gz · Last modified: 2021/05/28 20:37 by gwenpri.me