- Home /
EditorScript - Texture set isReadable, and yet not accessible
Unity 3.4.0 - Editorscripting
Hi,
I wrote an Assetpostprocessor editor script, in which I need to change some texture options.
All works well except Reading a texture.
If anyone has a suggestion, idea or knows if this is perhaps a known bug.
My implemented procedure:
1/ I set the texture's TextureImporter.isReadable to true
string path = AssetDatabase.GetAssetPath(tex);
TextureImporter texImporter = AssetImporter.GetAtPath(path) as TextureImporter;
texImporter.textureType = TextureImporterType.Advanced;
texImporter.textureFormat = TextureImporterFormat.ARGB32;
texImporter.isReadable = true;
2/ I reimport the asset with forceupdate as a parameter
AssetDatabase.ImportAsset(path,ImportAssetOptions.ForceUpdate);
3/ I do a security check to make sure the texture is set to readable
=> Unity returns a positive value, meaning it is indeed Readable and so I enter my if statementDebug.Log("Texture is readable: "+texImporter.isReadable);
if(texImporter.isReadable==true){
4/ I try to read the texture
=> Unity crashes the import and gives me a "is not readable" error for the texture. If I reiterate the import, the first texture goes fine. This time around he can really read the first texture on which he crashed last time, but crashes on the second texture, and so forth... Has anyone encountered and solved this issue? Any help would be appreciated.CMcol = tex.GetPixels();
interesting question. Havent tried nor seen this one. Will subscribe to this thread to hear others.
Your answer
![](https://koobas.hobune.stream/wayback/20220613005951im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Does enabling Read/Write on a texture double its memory usage? 1 Answer
Set TextureImporter.isReadable to true in script 0 Answers
Baking decals into a texture 3 Answers
SetPixels PROBLEM (trying to put decals) 0 Answers
Using GetPixels to break down an image, and only getting the last part. 1 Answer