Ok, I've been banging my head against a wall these past two days and I think I have an NGUI bug on my hands.
I have a scrollpanel with elements in, these include a friend picture in a UITexture (downloaded from online).
These UITextures should be able to update while being on the screen.
To test it out, I've made a little changepic script like so:
int num = 0;
void OnClick()
{
if (num % 2 == 0)
{
friendPicture.mainTexture = dummyFriendImage;
//friendPicture.panel.MarkMaterialAsChanged(friendPicture.material, true); //did nothing
//friendPicture.panel.UpdateDrawcalls(); //did nothing
}
else
{
friendPicture.mainTexture = dummyImage;
}
Debug.Log("num " + num);
num++;
}
where dummyImage and dummyFriendImage are set to something different in the inspector, of course.
So, my UIpanel has AlphaClipping and I set the UITexture to use the same shader ("unlit/Transparent Colored (AlphaClip)") otherwise it won't clip properly with the default ("unlit/texture").
If the picture is on screen, the change happens in the texture in the inspector just fine, but nothing happens on screen. When I set the panel's Debug Info to "Geometry" and look at the _UIDrawCall for the respective picture, it sill points to the old picture that was set on start up.
If I scroll the picture out of the clip rect, it gets removed and when I scroll it back in, it makes a new one with the new picture. It never changes if it stays on screen.
Is there a way I can force it to update?
I've tried MarkAsChanged on the UITexture and the ones you see in the code above, but none of the do anything. I've half a mind to take all the UIpanel's drawcalls and destroy them, so it can rebuild, but I fear it will backfire on me and either give a frame of blank space or just explode.
Help me ArenMook Kenobi, you're my only hope.