Unity Ignores the MainCamera Tag

I have two cameras, one for use with a RenderTexture and the other is the main camera.

The main camera is tagged "MainCamera" and the other is tagged "Untagged".

No matter what I do, unity uses the wrong camera to draw the scene.

I've tried

  • Creating the main camera first and then the other
  • Creating the other camera first and then the main
  • Reversing the tags!
  • Reversing their names!

Is there a way to tell Unity, OTHER than with tags, that I want to switch the active camera?

Multiple cameras will each render what they see. However, unless you limit them to portions of the screen (called viewports) one will always render on top of the other. Which renders first and which last is determined by the depth, not by which one is tagged as the main camera.

To switch from one camera to the other, try setting enabled=false on one of them.

A simple example of rendering with two cameras to different parts of the screen can be found here.

To overlay two camera views (for example if one is generating the background) see the documentation on Camera.clearFlags.

Any chance you by accident have two cameras tagged as MainCamera? happened to me once.