- Home /
How to get mipChain and linear values from existing Texture2D
For use with a camera gallery, I want to serialize Texture2D data constructor data to later reconstuct it. I have easy access to the byte[] for use with Texture2D.LoadRawTextureData after construction as well as the width, height, and format needed for one of the Constructor methods of Texture2D. However, I'm not sure how I can find out whether an existing Texture2D was constructed using true or false values for the mipChain and linear constructor fields in
public Texture2D(int width, int height, TextureFormat textureFormat = TextureFormat.RGBA32, bool mipChain = true, bool linear = false);
I believe I can do:
bool mipChain = tex.mipmapCount > 1 ? true : false;
in order to get the value for mipChain, but I'd like confirmation, or correction, in the case that I'm making an incorrect assumption.
As for the value for linear, is it possibly equivalent to the PlayerSettings.colorSpace value at the time of reading data from the Texture2d, or is there some other way to check?
Your answer
![](https://koobas.hobune.stream/wayback/20220612195537im_/https://answers.unity.com/themes/thub/images/avi.jpg)