I have a UITexture in my scene with no variables linked up to it. During runtime, I programmatically create a texture and assign it to the UITexture. I can see the texture that is created and see it linked up in editor. However nothing displays in my scene. I have tried changing the main texture and creating a new material.
Here is my code for setting the texture
public void SetTextureTo(Texture2D tex) {
/*
Material newMat = new Material(Shader.Find("Unlit/Transparent Colored"));
newMat.mainTexture = tex;
_tex.material = newMat;
*/
_tex.mainTexture = tex;
_tex.width = tex.width;
_tex.height = tex.height;
_tex.MarkAsChanged();
}
Interestingly enough, if I call _tex.panel.Refresh(); after the method then the UITexture displays, but I get a null reference exception because _tex.panel is null (I don't have it managed by a panel). If I have a panel for it or create one through CreatePanel() then the error disappears but the image doesn't show again! So really, I can't get my image to display without causing an error

I am running off the latest version of NGUI on Unity 4.3
Any suggestions?
Thanks