A way to set a custom camera.viewport background color?

You can easily setup the camera.backgroundColor in the inspector, but - when limiting the camera viewport - how to change the viewport background color from its default gray to anything else?

How would you do that? Put a GUI.Box or draw a gui coloured texture over it?

The best way that I have found to do this is to create another camera in your scene at the lowest depth and set that camera’s background color to whatever you like. In my case, I chose white so the game fits in better on Facebook’s layout.

Step by step instructions:

  • Choose GameObject → Create Other → Camera
  • Set Clear Flags to Solid Color
  • Set Background to whatever you like
  • Set Culling Mask to Nothing
  • Set Depth value to -2