Networking.DownloadHandlerTexture.DownloadHandlerTexture

Unity · Версия 2020.3 LTS · Scripting · DownloadHandlerTexture

Networking.DownloadHandlerTexture.DownloadHandlerTexture

Объявление

public DownloadHandlerTexture();

Описание

Конструктор по умолчанию.

Удобный конструктор. Предполагается, что значение readable равно false. Texture, возвращаемая texture, не будет иметь доступа к данным текстуры из скрипта.

using System.Collections;
using UnityEngine;
using UnityEngine.Networking;

public class Example : MonoBehaviour
{
    IEnumerator Start()
    {
        using (var uwr = new UnityWebRequest("https://website.com/image.jpg", UnityWebRequest.kHttpVerbGET))
        {
            uwr.downloadHandler = new DownloadHandlerTexture();
            yield return uwr.SendWebRequest();
            GetComponent<Renderer>().material.mainTexture = DownloadHandlerTexture.GetContent(uwr);
        }
    }
}

Объявление

public DownloadHandlerTexture(bool readable);

Параметры

readable Значение для установки TextureImporter.isReadable.

Описание

Конструктор позволяет установить свойство TextureImporter.isReadable.

Значение в readable будет использоваться для установки свойства TextureImporter.isReadable при импорте загруженных данных текстуры.

Обновлено 17 ноября 2026 г.