- Home /
reading a texture that was created via script runtime and not saved
I'm trying to save a texture that was created via script but I'm getting this error
UnityException: Texture '' is not readable, the texture memory can not be accessed from scripts. You can make the texture readable in the Texture Import Settings.
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
Any idea how to mark textures created at runtime as read / writable?
Answer by Maximetinu · Jun 03, 2017 at 11:52 PM
I can give you this link, but without more context I'm not sure if it will help you. I hope so!
TextureImporter.isReadable: Set this to true if you want texture data to be readable from scripts. Set it to false to prevent scripts from reading texture data.
During the game I'm getting bytes from a www class and drawing a new texture so editor scripts are gonna cut it I think, unfortunately.
According to the Scripting API, in the WWW Class there are two public members for extracting the texture from the received bytes WWW.textureNonReadable and WWW.texture, and the one you should use is WWW.texture
Have you used it?
No because im downloading a GIF rather than 1 texture so I have to do it by bytes and then draw them into textures afterwards
So I guess you are taking the WWW.bytes to after creating an Texture object. $$anonymous$$aybe check the method Texture2D.LoadImage as it loads a bytes array into the Texture2D object and you can set as second argument bool markNonReadable = false to make it readable.
public bool LoadImage(byte[] data, bool markNonReadable = false);
Is it useful?
Your answer
![](https://koobas.hobune.stream/wayback/20220612123434im_/https://answers.unity.com/themes/thub/images/avi.jpg)