Creating a picture-in-picture effect
Having more than one viewport displayed can be useful in many situations. For example, you may want to show simultaneous events going on in different locations, or you may want to have a separate window for hot-seat multiplayer games:

Getting ready
This recipe adds to the scene created in the first recipe of this chapter, so make a copy of that project folder and do your work for this recipe with that copy.
How to do it...
To create a picture-in-picture display, just follow these steps:
- Add a new
Camera
to the scene namedCamera-pic-in-pic
. Choose menu:Create
|Camera
. - In the
Inspector
, for theCamera
component, set the Depth property to1
. - Uncheck or remove the camera's
Audio Listener
component, since there should only be one activeAudio Listener
in a Scene. - Create a new C# script-class named
PictureInPicture
, and add an instance-object as a component to theCamera-pic-in-pic
GameObject:
using UnityEngine; public class PictureInPicture : MonoBehaviour...