Richard Morgan

Here’s an easy way to switch cameras using triggers in Unity. Here’s the result:

We’ll use a GameObject called Managers to hold the CameraManager script that makes our array values available, and it will also hold our public functions that will update the priorities on the cameras as the triggers are fired:

--

--

Here’s an easy way to add an interactive zoom to your Virtual Camera in Unity by ‘using Cinemachine’ GetComponent<CinemachineVirtualCamera>().m_Lens.FieldOfView.

Here we have a simple scene that includes a Virtual Camera, a Plane, an animated Cube and a Sphere:

Adding this script will allow us to update the Field Of View on the Virtual Camera:

--

--

Let’s explore how easy it is to switch between cameras using Cinemachine. We’ll start with a simple scene that includes a Virtual Camera, an animated cube and a sphere hovering above a plane:

We want a script that switches the camera from the animated cube to the sphere. So to do that, let’s use GetComponent<CinemachineVirtualCamera>().LookAt which we can access by ‘using Cinemachine’. We’ll create variables that hold a references to the Virtual Camera and the target objects:

--

--

We’re importing an SRP project into an HDRP project so that we can use some fancy post-processing effects because we want the scene to look more realistic on a PC. Note that the HDRP project gameplay is resource intensive. If our game were targeting the mobile platform, we would use URP instead.

Let’s start by opening a new project using the HDRP template:

Once the project is loaded, import the new project package and open the scene to view the materials (highlighted in pink) that need to be converted to HDRP:

--

--

Decals are handy when you want an image to be mapped to the surface of a tessellated object like this:

Using pre-prepared decals is a snap. FileBase decals are already attached to a Decal Projector and ready to use. The Decal Projector provides a volume for the decal to wrap within.

--

--

Richard Morgan

Richard Morgan

Unity and Flutter developer interested in creating mixed-reality applications.