public JsonTexture(Texture tex, ResourceMapper resMap) { name = tex.name; id = resMap.findTextureId(tex); //exp.textures.findId(tex); var assetPath = AssetDatabase.GetAssetPath(tex); resMap.registerAssetPath(assetPath); path = assetPath; filterMode = tex.filterMode.ToString(); width = tex.width; height = tex.height; wrapMode = tex.wrapMode.ToString(); var tex2D = tex as Texture2D; var rendTarget = tex as RenderTexture; isTex2D = tex2D != null; isRenderTarget = rendTarget != null; var importer = AssetImporter.GetAtPath(assetPath); var texImporter = importer as TextureImporter; //(TextureImporter)importer; if (isTex2D) { alphaTransparency = tex2D.alphaIsTransparency; format = tex2D.format.ToString(); } if (isRenderTarget) { anisoLevel = rendTarget.anisoLevel; } if (texImporter) { importDataFound = true; sRGB = texImporter.sRGBTexture; textureType = texImporter.textureType.ToString(); normalMapFlag = (texImporter.textureType == TextureImporterType.NormalMap); } texParams = new JsonTextureParameters(tex); texImportParams = new JsonTextureImportParameters(texImporter); textureRef = tex; }