GUI.DrawTexture shows in Unity but not in Build

Hey folks, this issue is so strange that I’m convinced I’ve done something stupid.

I’m building a game with a GUI image using GUI.DrawTexture. When I test the game in Unity, the texture shows. When I build the game for Windows or Mac, it doesn’t. I know it’s not an issue with positioning since I’m setting it to be centered on the screen to be sure it shows up. I’ve also tried other GUI methods like DrawButton and DrawLabel, and they work as expected. I saw someone suggest that I remove my Scene from the build and then re-add it. This had no noticeable effect.

It might be worth noting that I’m porting my code from Javascript to C#, and this exact code and image worked as expected in Javascript.

Anyway, here’s my code:

	void OnGUI(){
		GUI.DrawTexture(new Rect(Screen.width * 0.5f, Screen.height * 0.5f, 112.0f, 124.0f), timerBar);

Any ideas? Thanks!

I’m having very similar issue right now. The only difference is that I’m using DrawTexture method only on repaint and with custom material (particle-additive):

void OnGUI () {
    if (Event.current.type.Equals(EventType.Repaint)) 
        Graphics.DrawTexture(new Rect(), texture, material);

Also, I’m using some post effects (image effects) on the main camera.

I found, that turning all the image effects off lets the texture show up in the build. Then you can enable them again, and texture will continue rendering normally.

I just sent bug report with repro project and hope that Unity will fix it someday…

I have already met this problem on a AMD card. I found a solution here: Programmer's Journal: January 2012.

The trick is to take off the alpha layer of the render texture during postrender. It works!