DownloadHandlerTextureConstructor

切换到手册
public DownloadHandlerTexture ();

描述

默认构造函数。

便捷构造函数。假设 readable 的值为 falsetexture 返回的 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 属性。