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.

DownloadHandler.ReceiveData

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
protected function ReceiveData(data: byte[], dataLength: int): bool;
protected bool ReceiveData(byte[] data, int dataLength);

Parámetros

data A buffer containing unprocessed data, received from the remote server.
dataLength The number of bytes in data which are new.

Valor de retorno

bool True if the download should continue, false to abort.

Descripción

Callback, invoked as data is received from the remote server.

This callback is invoked on the main thread.

Data arriving from the remote server for a DownloadHandlerScript is kept in a temporary ringbuffer.

When there is unprocessed data in the buffer, this method will be called once per frame to hand chunks of that data to script. (If multiple datagrams arrive within one frame, they will be combined before being passed to this callback.) The data byte array contains the received data.

When operating in non-preallocated mode, the system will allocate a new byte array each time this callback is invoked. In this case, data.Length will be equal to dataLength, and you may safely ignore the dataLength argument.

When operating in preallocated mode, the data argument will be the byte array passed in at construction time, and the dataLength argument indicates which bytes in the byte array are new. (Important: The system does not zero-out the array between calls.)

See DownloadHandlerScript.ctor for more information on allocation modes.