Hi guys,
I have posted this question to answers but did not get reply so I’m trying here.
http://answers.unity3d.com/questions/873550/unity3d-android-gui-flickering-rendertexture-glcle.html
Basically I get GUI flicker on keyboard or mouse input when GUI is rendered to rendertexture.
Here is a screen recording that is showing this.
https://dl.dropboxusercontent.com/u/22506069/guiFlicker.mov
It is happening if following is met
- OnGUI has set active render texture and any GUI is rendered to this texture. RenderTexture.active=mytexture;
- There is GL.Clear(false, true, new Color(0.0f, 0.0f, 0.0f, 1.0f)); in the OnGUI to clear render texture. Funny enough the flicker is present if color is with Alpha value (can be any alpha value even 1.0) but it is not present when using Color.black for example.
- If I call GL.Clear in every OnGUI call GUI is drawn properly on texture and flickering is happening only when you press any key or mouse button. If I call GL.Clear like every half a second, then flicker is present every half a second on each clear and it does not happen on key or mouse press anymore.
- it is happening when project is switched to Android. If I run the same in editor on Mac with project set as standalone flickering can be seen in scene view but not in the Game view.
here is sample plain project to test the issue
https://dl.dropboxusercontent.com/u/22506069/uiRenderTextflicker.zip
the only code in the scene is
void OnGUI(){
RenderTexture.active=rentext;
//if (Time.time-lastCleared>0.005f){
GL.Clear(false, true, new Color(0.0f, 0.0f, 0.0f, 1.0f));
// lastCleared=Time.time;
//}
GUI.Button(new Rect(50,50,300,100),"Hayyyyy");
RenderTexture.active=null;
}
I’m running on latest OSx 10.10 something and latest Unity pro 4.6.1f1
Any ideas what is causing this?
Thanks for help