I have a camera that I’ve assigned a render texture to, so it doesn’t display on the main application window. Using the OnGUI() function doesn’t render any GUI elements to this camera, but it does to my other cameras which are displayed on the screen. Is there a way to include this camera in displaying the GUI elements from OnGUI()?
Figured out the issue. I just had to set the active RenderTexture
to my camera’s target texture in OnGUI(), for example:
void OnGUI()
{
RenderTexture.active = myCam.targetTexture;
GUI.Box(new Rect(200.0f, 100.0f, 600.0f, 300.0f), "Test");
RenderTexture.active = null;
}