- Home /
Image loaded with LoadImageIntoTexture gets inverted
I'm trying to use an image loaded with LoadImageIntoTexture as the texture of a simple plane. I have to set the tiling of my texture to (1,-1) for some other logic in my project. the problem is when I load the image using LoadImageIntoTexture the image gets distorted and doesn't show up correct with my tiling values. this problem doesn't happen when manually assign the same texture with inspector.
I'll appreciate if someone can help me with this , here's the code I use :
WWW www = new WWW(url);
texTmp = new Texture2D(500,333,TextureFormat.DXT5,false);
www.LoadImageIntoTexture(texTmp);
myPlane.renderer.material.mainTexture = texTmp;
What does "distorted" mean and what's the textures format (jpg or png)? Btw you can't set a tiling of a texture, only of materials which might use your texture. It would help if you explained all those points more in detail. A screenshot would save hundreds of words. If you don't want to show your texture, can you reproduce your problem with a dummy texture of the same size / type?
@Bunny83 the tiling causes my loaded image with LoadImageIntoTexture to gets distorted but the same tiling won't cause any effect when I assign the same image from my assets on inspector
@smtabatabaie: ... really, how are we supposed to help you when you don't provide any useful information. I asked what does distorted means. I don't want to know this one, we need to know what's actually wrong. If you visit a doctor and you just tell him: "I feel sick" he won't be able to help you.
$$anonymous$$e and thousands others have downloaded images at runtime and used them successfully. You might be doing something wrong, but we can't find out what that something is with the information you gave us.
I ask for a screenshot which shows the problem. You said you can produce a "good" result when you assign the texture from your assets. If would be great to have two screenshots, one correct and one that shows the problem.
If you can't improve your question i'm going to close it since we can't reproduce your problem.
I tried other image files for download function and it was ok , it seems the problem was my image, still don't know what was wrong with the image and I'm afraid if it happens some time in the future for other images. The thing I was suspected was that doing tiling and different shaders may not work on files downloaded from a url and files should be local to do shader processing on them , and this theory is now obviously incorrect. thank @Bunny83