Closed Guarneri1743 closed 2 years ago
Thank you for the PR. I'm going to take a look at it over the weekend.
Thanks again for your contribution. You changes can be found in version 1.4.0 which I just released.
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/
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?
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.