Version: 5.3 (switch to 5.4b)
IdiomaEnglish
  • C#
  • JS

Idioma de script

Selecciona tu lenguaje de programación favorito. Todos los fragmentos de código serán mostrados en este lenguaje.

UnityWebRequest.GetAssetBundle

Sugiere un cambio

¡Éxito!

Gracias por ayudarnos a mejorar la calidad de la documentación de Unity. A pesar de que no podemos aceptar todas las sugerencias, leemos cada cambio propuesto por nuestros usuarios y actualizaremos los que sean aplicables.

Cerrar

No se puedo enviar

Por alguna razón su cambio sugerido no pudo ser enviado. Por favor <a>intente nuevamente</a> en unos minutos. Gracias por tomarse un tiempo para ayudarnos a mejorar la calidad de la documentación de Unity.

Cerrar

Cancelar

Cambiar al Manual
public static function GetAssetBundle(uri: string, crc: uint): Experimental.Networking.UnityWebRequest;
public static Experimental.Networking.UnityWebRequest GetAssetBundle(string uri, uint crc);
public static function GetAssetBundle(uri: string, version: uint, crc: uint): Experimental.Networking.UnityWebRequest;
public static Experimental.Networking.UnityWebRequest GetAssetBundle(string uri, uint version, uint crc);
public static function GetAssetBundle(uri: string, hash: Hash128, crc: uint): Experimental.Networking.UnityWebRequest;
public static Experimental.Networking.UnityWebRequest GetAssetBundle(string uri, Hash128 hash, uint crc);

Parámetros

uri The URI of the asset bundle to download.
crc If nonzero, this number will be compared to the checksum of the downloaded asset bundle data. If the CRCs do not match, an error will be logged and the asset bundle will not be loaded. If set to zero, CRC checking will be skipped.
version An integer version number, which will be compared to the cached version of the asset bundle to download. Increment this number to force Unity to redownload a cached asset bundle.

Analogous to the version parameter for WWW.LoadFromCacheOrDownload.
hash A version hash. If this hash does not match the hash for the cached version of this asset bundle, the asset bundle will be redownloaded.

Valor de retorno

UnityWebRequest A UnityWebRequest configured to downloading a Unity Asset Bundle.

Descripción

Creates a UnityWebRequest optimized for downloading a Unity Asset Bundle via HTTP GET.

This method creates a UnityWebRequest, sets the method to GET and sets the target URL to the string uri argument. Sets no other flags or custom headers.

This method attaches a DownloadHandlerAssetBundle to the UnityWebRequest. This DownloadHandler has a special DownloadHandlerAssetBundle.assetBundle property, which can be used to extract the asset bundle once enough data has been downloaded and decoded to permit access to the resources inside the bundle.

In addition, the DownloadHandlerAssetBundle streams data into a ringbuffer and decompresses the data on a worker thread, saving many memory allocations compared to downloading the data all at once.

If supplied with an integer version or Hash128 hash argument, the DownloadHandlerAssetBundle will employ the Asset Bundle caching system. If an Asset Bundle has been cached and does not need to be redownloaded, then the UnityWebRequest will complete once the Asset Bundle has finished loading from the cache.