Camera.SetTargetBuffers - Correct usage for MRTs?

Hello Unity Community! It’s been a while.

So as of late, I’m working on a deferred renderer for a small project, and I can’t quite seem to get Camera.SetTargetBuffers working correctly! Every time I attempt to run the script, I get the following in the console along with the editor’s GUI deciding to go blank shortly there after:

Releasing render texture that is set to be RenderTexture.active!
RenderTexture warning: Destroying active render texture. Switching to main context.

I’m not entirely sure why this is!

Here’s some code to give an idea of what I’m doing to trigger this:

using UnityEngine;
using System.Collections;

[RequireComponent(typeof(Camera))]
public class DeferredCamera : MonoBehaviour {
	private RenderTexture[] mrtTex = null;
	private RenderBuffer[] mrtRB = new RenderBuffer[3];
	private GameObject dummyCam = null;
	public Shader geometryBufferShader = null;

	// Use this for initialization
	void Start () {
		mrtTex = new RenderTexture[3] {
			new RenderTexture(Screen.width, Screen.height, 24, RenderTextureFormat.ARGB32),
			new RenderTexture(Screen.width, Screen.height, 24, RenderTextureFormat.ARGB32),
			new RenderTexture(Screen.width, Screen.height, 24, RenderTextureFormat.ARGB32)
		};
		mrtRB[0] = mrtTex[0].colorBuffer;
		mrtRB[1] = mrtTex[1].colorBuffer;
		mrtRB[2] = mrtTex[2].colorBuffer;
		dummyCam = new GameObject("Dummy Camera", typeof(Camera));
		dummyCam.hideFlags = HideFlags.HideAndDontSave;
	}

	void OnPreRender()
	{
		dummyCam.camera.SetTargetBuffers(mrtRB, mrtTex[0].depthBuffer);
		dummyCam.camera.clearFlags = CameraClearFlags.SolidColor;
		dummyCam.camera.RenderWithShader(geometryBufferShader, "RenderType");
	}
}

I feel it’s worth noting that it doesn’t matter if I have a separate camera that I’m invoking RenderWithShader on or not. Using Graphics.SetRenderTarget does make a difference with a bit of manual work to ensure that the previous render texture is set as the active render texture again, but that results in nothing being rendered beyond the clear color.

It may also be worth mentioning that I’m doing this on OS X 10.9.1 as well. Any ideas what could be going wrong here?

Edit: Also, modifying OnPreRender to this:

		RenderTexture rt = RenderTexture.active;
		dummyCam.camera.SetTargetBuffers(mrtRB, mrtTex[0].depthBuffer);
		dummyCam.camera.clearFlags = CameraClearFlags.SolidColor;
		dummyCam.camera.RenderWithShader(geometryBufferShader, "RenderType");
		RenderTexture.active = rt;

has no effect what so ever.

Edit #2: To generally clarify why this is under Support instead of ShaderLab, well, I’m pretty sure that this shouldn’t be happening when I run the above code:

Did you ever get SetTargetBuffers to work with 4.3?

can you please create a small repro project and bug report it? We have a special test internally just for that kind of usage (MRT through SetTargetBuffers) so it should work