Version: 2021.1
LanguageEnglish
  • C#

CameraSettings

class in UnityEditor

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Use this class to set SceneView Camera properties.

// Create a folder (right click in the Assets directory, click Create>Folder)
// and name it Editor if one doesn't exist already. Create a new C# script called CustomSettings
// and place it in that folder.

// This script creates a new menu item Edit>SceneView Settings>Update Camera Settings in the main menu. // Use it to update the Camera settings in the Scene view.

using UnityEditor;

public class CustomSettings { [MenuItem("Edit/SceneView Settings/Update Camera Settings")] static void UpdateCameraSettings() { SceneView.CameraSettings settings = new SceneView.CameraSettings(); settings.accelerationEnabled = false; settings.speedMin = 1f; settings.speedMax = 10f; settings.speed = 5f; settings.easingEnabled = true; settings.easingDuration = 0.6f; settings.dynamicClip = false; settings.fieldOfView = 120f; settings.nearClip = 0.01f; settings.farClip = 1000f; settings.occlusionCulling = true; SceneView sceneView = SceneView.lastActiveSceneView; sceneView.cameraSettings = settings; } }

Properties

accelerationEnabledEnables Camera movement acceleration in the SceneView. This makes the Camera accelerate for the duration of movement.
dynamicClipWhen enabled, the SceneView Camera's near and far clipping planes are calculated relative to the viewport size of the Scene. When disabled, nearClip and farClip are used instead.
easingDurationHow long it takes for the speed of the SceneView Camera to accelerate to its initial full speed. Measured in seconds. Valid values are between [0.1, 2].
easingEnabledEnables Camera movement easing in the SceneView. This makes the Camera ease in when it starts moving, and ease out when it stops.
farClipThe furthest point from the SceneView Camera that drawing occurs. The valid minimum value is 0.02.
fieldOfViewThe height of the view angle for the SceneView Camera. Measured in degrees vertically, or along the local Y axis.
nearClipThe closest point to the SceneView Camera where drawing occurs. The valid minimum value is 0.01.
occlusionCullingEnables occlusion culling in the SceneView. This prevents Unity from rendering GameObjects that the Camera cannot see because they are hidden by other GameObjects.
speedThe speed of the SceneView Camera.
speedMaxThe maximum speed of the SceneView Camera. Valid values are between [0.02, 99].
speedMinThe minimum speed of the SceneView Camera. Valid values are between [0.01, 98].
speedNormalizedThe normalized speed of the SceneView Camera, relative to the current minimum/maximum range. Valid values are between [0, 1].

Constructors

SceneView.CameraSettingsCreate a new CameraSettings object.