Don't clear camera flags not working as expected
I'm trying to render a single image to the screen as my background. Considering this image is static and never moves or changes, I tried to set up a camera with "don't clear" flags, and then set up some code to render an image only one time. This is what I have:
void OnGUI()
{
if (dirtyFlag)
{
GUI.DrawTexture( new Rect(0,0,Screen.width, Screen.height), myTexture);
dirtyFlag = false;
}
}
With this code, I expect to set the dirty flag, it will draw the texture, and then the "don't clear" render flag on the camera will keep it there forever.
However, instead, it remains black. It has definitely been rendered, because if I don't flip the flag back to false, which means it's rendering every frame, the texture shows up as intended. I imagine that something is clearing the image from the buffer.
Does this mean that the don't clear flag is not working as expected?
Is there another way to render a single image on screen only once and not per-frame?
Your answer
Follow this Question
Related Questions
Texture2D ReadPixels for specific Display 0 Answers
ScreenCapture.CaptureScreenshotAsTexture() is making a milky white tinted screenshot. 1 Answer
Trying to Take a Snapshot of Only a Portion of the Screen In-Game 0 Answers
how can i store a screenshot into android mobile? 0 Answers
Rotate Texture2D to face camera 1 Answer