Version: 2020.3

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 属性。

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961