Version: 2021.3

Texture2D.Reinitialize

切换到手册
public bool Reinitialize (int width, int height);
public bool Reinitialize (int width, int height, Experimental.Rendering.GraphicsFormat format, bool hasMipMap);
public bool Reinitialize (int width, int height, TextureFormat format, bool hasMipMap);

参数

width New width of the Texture.
height New height of the Texture.
format New format of the Texture.
hasMipMap Indicates if the Texture should reserve memory for a full mip map chain.

返回

bool Returns true if the reinitialization was a success.

描述

Reinitializes a Texture2D, making it possible for you to replace width, height, textureformat, and graphicsformat data for that texture. This action also clears the pixel data associated with the texture from the CPU and GPU.
This function is very similar to the Texture constructor, except it works on a Texture object that already exists rather than creating a new one.
It is not possible to reinitialize Crunched textures, so if you pass a Crunched texture to this method, it returns false. See texture formats for more information about compressed and crunched textures.
Call Apply to upload the changed pixels to the graphics card.
Texture.isReadable must be true.

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