pschraut / UnityTexture2DArrayImportPipeline

A Texture2DArray Import Pipeline for Unity 2019.3 and newer.
MIT License
164 stars 18 forks source link

support setting readability #7

Closed Guarneri1743 closed 2 years ago

Guarneri1743 commented 2 years ago

A newly created texture2darray is readable by default, the bad thing is, readable textures will keep a copy of texture data in memory to support functions like Get/SetPixels, but most of the time we don't need them at all. So It might be useful to support non-readable texture2darray. unity will serialize the 'readable' field automatically after calling texture2DArray.Apply(bool updateMipmaps, bool makeNoLongerReadable), and this api is compatible with most of the released unity versions.

pschraut commented 2 years ago

Thank you for the PR. I'm going to take a look at it over the weekend.

pschraut commented 2 years ago

Thanks again for your contribution. You changes can be found in version 1.4.0 which I just released.

pschraut commented 2 years ago

FYI a Texture2DArray with "Read/Write Enabled" turned off, is displayed with 0 bytes size in the Profiler. I submitted a bug-report to Unity Technologies about this issue and posted in their forums, see https://forum.unity.com/threads/case-1410061-profiler-displays-texture2darray-with-0-bytes-size.1251414/

Guarneri1743 commented 2 years ago

FYI a Texture2DArray with "Read/Write Enabled" turned off, is displayed with 0 bytes size in the Profiler. I submitted a bug-report to Unity Technologies about this issue and posted in their forums, see https://forum.unity.com/threads/case-1410061-profiler-displays-texture2darray-with-0-bytes-size.1251414/

In my experience, the runtime memory calculation of Unity's Profiler is not so reliable, e.g. compressed textures, it's really confusing to me sometimes. Maybe a better option is to use the native profiler of specific platform?