Version: 2021.2
LanguageEnglish
  • C#

Texture.isReadable

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public bool isReadable;

Description

Whether Unity stores an additional copy of this texture's pixel data in CPU-addressable memory.

This is required for methods that read, write, and manipulate the pixel data on the CPU, such as Texture2D.GetPixels or ImageConversion.EncodeToPNG. It is not required for methods that perform all their work on the GPU, such as Graphics.CopyTexture or Graphics.Blit.

By default, this is false for texture assets that you import into your project. To toggle this, use the Read/Write Enabled setting in the Texture Import Settings, or set TextureImporter.isReadable.

By default, this is true when you create a texture from a script.

Note: Readable textures use more memory than non-readable textures. You should only make a texture readable when you need to, and you should make textures non-readable when you are done working with the data on the CPU.

To make a texture non-readable at runtime, call the Apply method for your type of texture, for example Texture2D.Apply or Cubemap.Apply and set the makeNoLongerReadable parameter to true.

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