After upgrading from Unity 5.1.1f1 to 5.3.1f1, I have a feature in my game using SetTexture/ RenderTexture which no longer works. I have a build of the game running on a separate laptop using 5.1.1f1 which still works correctly. The code looks like this:
m_ScreenShot = CaptureScreen();
m_ScreenCapMat.SetTexture( 0, (Texture)m_ScreenShot);
The CaptureScreen function consists of this:
RenderTexture CaptureScreen() {
Camera screen_cap = m_ScreenShotCam.GetComponent<Camera>();
screen_cap.enabled = true;
RenderTexture rt = new RenderTexture( screen_cap.pixelWidth, screen_cap.pixelHeight, 24 /*depth*/);
screen_cap.targetTexture = rt;
screen_cap.Render();
screen_cap.enabled = false;
return rt;
}
Do I need to update something to get this working in 5.3.1f1?