UnityTexture2DArrayImportPipeline icon indicating copy to clipboard operation
UnityTexture2DArrayImportPipeline copied to clipboard

QualitySettings.masterTextureLimit preventing Importer from working correctly

Open ghost opened this issue 3 years ago • 4 comments

https://docs.unity3d.com/ScriptReference/QualitySettings-masterTextureLimit.html

The above setting changes which mipmap Unity uses for a texture. While it affects Texture2D, it does not affect Texture2DArray. I am posting the error and my quick-fix solution. This fix is trivial and I do not know if there is a better way to approach this. Posting screenshots of the error and the fix. Screenshot_1 Screenshot_2

ghost avatar Dec 05 '21 23:12 ghost

Thank you!

pschraut avatar Dec 06 '21 15:12 pschraut

No problem. Currently this solution makes it so the resulting Texture2DArray always uses mip 0. Unity does say QualitySettings.masterTextureLimit does not affect Texture Arrays, so I'm certain this solution is incorrect, since it does not copy all the mips. As per the manual, here's what it says on Copy Texture: Screenshot_5

Then again, changing the masterTextureLimit should yield no effect even if all the mips are loaded correctly, unless the importer somehow uses it. I believe this is the last step in order to complete the importer.

ghost avatar Dec 06 '21 19:12 ghost

Thank you again for the report and additional information. I submitted a bug-report to Unity Technologies (logged as Case 1393786). I'll update this thread here if I hear back from Unity.

pschraut avatar Jan 10 '22 11:01 pschraut

Unity Technologies replied to bug-report 1393786 with:

After reaching out to the developers about this issue, here is what I've gathered: using masterTextureLimit to copy from Texture2D to Texture2DArray was never supported, but error reporting on this has changed. In the past, CopyTexture was quiet about this and just didn't do the copy. What might help here is to use the region copy overload of CopyTexture. That overload does take into account masterTextureLimit in a specific way. The Documentation describes this here: https://docs.unity3d.com/2022.1/Documentation/ScriptReference/Graphics.CopyTexture.html

As far as I understand the documentation, it doesn't sound to me that it would fix the problem that's described here.

When masterTextureLimit is used, the "copy region" command would copy the lower-mipmaps into the Texture2DArray, but what's actually expected is that it should copy the texture as no masterTextureLimit is used.

It seems there is currently no solution to resolve this issue. The only solution seems to use no masterTextureLimit at all.

pschraut avatar Feb 06 '22 10:02 pschraut