Version: 5.3 (switch to 5.4b)
ЯзыкEnglish
  • C#
  • JS

Язык программирования

Выберите подходящий для вас язык программирования. Все примеры кода будут представлены на выбранном языке.

DownloadHandler.ReceiveData

Предложить изменения

Успех!

Благодарим вас за то, что вы помогаете нам улучшить качество документации по Unity. Однако, мы не можем принять любой перевод. Мы проверяем каждый предложенный вами вариант перевода и принимаем его только если он соответствует оригиналу.

Закрыть

Ошибка внесения изменений

По определённым причинам предложенный вами перевод не может быть принят. Пожалуйста <a>попробуйте снова</a> через пару минут. И выражаем вам свою благодарность за то, что вы уделяете время, чтобы улучшить документацию по Unity.

Закрыть

Отменить

Руководство
protected function ReceiveData(data: byte[], dataLength: int): bool;
protected bool ReceiveData(byte[] data, int dataLength);

Параметры

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

Возврат значений

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

Описание

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.