Hi, I've encountered a slight problem when using UITexture and i haven't been able to figure out why its happening or what I'm doing wrong to cause said problem. So i turn to you guys in hope that you will be able to shed some light on the matter.
The problem is basically that when i change an UITextures material with my facebookpicture material the old texture will somehow still show on the screen(like its burned in / wont clear). Its not an object i can interact with in any way through the unity editor.
the scenes camera clearflags are set to depth only.
I tried changing the texture instead and then it worked as long as i marked the UITexture as changed. But just changing the texture isn't really an option since that would change the texture on anything using that material.
ill paste the basic code snippets where i create the facebook material, and change the UITextures material below.
ill also attach a picture of the problem(the white square left by the right picture is the old texture that doesn't feel like leaving=)).
feel free to ask if I've missed to include some information and ill try to provide it.
appreciate any help you can give me on this =) thanks
//facebook pic material
WWW request = new WWW( anURL );
yield return request;
if( request.error != null || request.texture == null )
{
aCallback(null,false);
yield break;
}
Shader shader = Shader.Find("Unlit/Transparent Colored");
Material mat = new Material(shader);
mat.mainTexture = request.texture;
mat.name = "ProfilePicture";
//this is just simply me changing the material on the texture
myUITexture.material = myFacebookPicture.myMaterial;