Using the Main Camera GameObject in Unity to Get the Perfect View

iD Tech in action

So you want to modify the camera in your game to get the view you want? Let's get into it!

To present your game in the best possible way, it's important to understand how to navigate the camera. 

Camera Positioning

When a game is running, there might be times when the game view isn't displaying properly.

There are two ways to fix this:

The first way is to manually adjust the position of the camera in the scene view, which will adjust how it looks in the Game view (which is what the player will see). 

Select the "Main Camera" in the Hierarchy, then adjust the camera's position and rotation to set a different viewing angle. 

(The mini camera in the bottom right corner can help you see what the Game view will look like.)

Check how the camera looks in the Game view and continue to adjust until you like it.

Adjust by View

You can also automatically adjust the camera to match your view in the scene.

Zoom and move around your scene until you're looking at your game from a good angle. 

Select "Main Camera" in the Hierarchy. Select "GameObject" > "Align with View."

Test your game to see how it matches your Scene view!

Now your camera has auto-adjusted to how you were viewing your scene.

Field of View

You can also modify many aspects of the camera to achieve the right view:

Select your "Main Camera" and then zoom and rotate the camera in the scene, keeping an eye on the white dots outlining a square. 

This white square represents the field of view, and the field of view controls the width of the camera's view angle. The field of view is also a component in the Inspector. It's measured in degrees along the Y-axis (A higher Field of View can display more of the view).

For instance, with the Main Camera selected, move the "Field of View" slider in the Inspector to the left and right. Watch how the Camera Preview window changes!

Projection

There are two types of Projections, or ways that the camera renders perspective:

  • Perspective 
  • Orthographic 

Perspective is the default view of the game. The camera will render with perspective intact.

Orthographic will render the objects uniformly with no sense of perspective. This means that things don't get bigger as they get closer to you. 

To see it in action, select the Main Camera then toggle between the two Projections in the Inspector to see the difference

In all, the camera allows a lot of customization, from choosing between Skybox or solid color to modifying the field of view. Changing these will customize the game further!

Recap

To summarize, adjust the camera view manually or by aligning with the scene. The field of view determines how much a camera can see and Projection determines whether perspective is enabled or not. Knowing how to manipulate the camera is important because it's the view players will see in the game!

A photo of Ryan

Ryan has been in EdTech and with iD Tech for 13 years—building experience, expertise, and knowledge in all things coding, game development, college prep, STEM, and more. He earned his MBA from Santa Clara University after obtaining his Bachelor’s degree from Arizona State. Connect on LinkedIn

Featured Posts

Categories

Authors

About iD Tech

iD Tech is the #1 tech camp on the planet, and world leader in youth STEM education, with programs held online and at 75+ global locations offering 50+ innovative tech courses: 

Coding camps
Video game camps
Robotics classes & camps
Creative arts classes & camps
All STEM camps

We've bet our reputation on recruiting the top instructors in the country. Our small classes ensure customized learning, leading to "a-ha moments" and awesome outcomes. Programs include:

On-Campus Programs

Online Tutoring

All Coding Courses