PIP Map Effect In Unity

Introduction

This article demonstrates how to add "Picture In Picture" map effect in your Unity project.

Prerequisites

  • Unity Environment version 5.6.1

Once again, refer my previous article to get started.

Add sphere in your project

Step 1

First, you have to create the terrain, trees, and water. Add the first person controller in your project. Select the Main camera. Go to inspector window and change the name into map camera.

Click on the FPS Controller. The first person character will be displayed. Click on the First person character.

Go to the Game Object menu in the menu bar. Select 3D Object >> Sphere.

The sphere will be displayed in the terrain.

Select the sphere and go to "Add component". Click on the add component and select Rendering.

Select Camera. The camera will be added into sphere.



The sphere camera preview will be displayed.

Create material

Step 2

Right click on the mouse and select Create >> Material.

Go to the inspector window and click on the color box. Select the color and change the material name into red.

Drag and drop the Material into sphere. The sphere color will now be changed.

PIP Camera effect

Step 3

Click on the FPS Controller and go to the position. Copy the x-axis, y-axis and z-axis values.

Click on the sphere and paste these values in the position fields.

The sphere will be displayed in FPS Controller position.

Drag and drop the sphere into FPS controller like the following.



Click on the Map camera. The camera preview will be displayed. The sphere will also be displayed into the camera preview.

Increase the Map camera size like the following. The changes will be displayed in preview.

Click on the First Person Character. The camera preview will be displayed like the following.

Go to the inspector window and give the depth value -1.

Click on the Map camera; go to the inspector window, and select the Viewport Rect. Give x-axis, y-axis values as 0.75 and 0.25 respectively.

Now, click on the "Play" button. The Game View will look like the following. The sphere camera preview will be displayed in the corner window.

Press “w” “a” “s” “d” to moving the sphere into front, left, back and right. Now, the sphere can move like in the following image.

Summary

I hope, you understood how to add "Picture In Picture" map effect in your Unity project.


Similar Articles