Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


SceneView

Use this class to manage SceneView settings, change the SceneView camera properties, subscribe to events, call SceneView methods, and render open scenes.
Read time 10 minutesLast updated 2 days ago

Definition

[EditorWindowTitle(title = "Scene", useTypeNameAsIconName = true)]public class SceneView : SearchableEditorWindow, IHasCustomMenu, ISupportsOverlays

Static Fields

Value

Description

lastActiveSceneViewChangedRegister to this callback to get notified when the active Scene View changes.

Properties

Property

Description

audioPlayEnables or disables Scene view audio effects.
cameraThe Camera that is rendering this SceneView.
cameraDistanceThe distance from SceneView.camera to SceneView.pivot.
cameraModeThe current DrawCameraMode for the Scene view SceneView.camera.
cameraSettingsUse SceneView.CameraSettings to set the properties for the SceneView Camera.
cameraViewportThe position and size of the area that the camera renders.
drawGizmosSets the visibility of all Gizmos in the Scene view.
in2DModeWhether the SceneView is in 2D mode.
isRotationLockedWhether the Scene view SceneView.camera can be rotated.
isUsingSceneFilteringWhether this SceneView is using scene filtering.
lastSceneViewRotationWhen the Scene view is in 2D mode, this property contains the last SceneView.camera rotation.
orthographicWhether the Scene view camera is set to orthographic mode.
pivotThe central point that the camera orbits within the Scene view.
rotationThe direction of the SceneView.camera to the SceneView.pivot of the SceneView.
sceneLightingWhether lighting is enabled or disabled in the Scene view.
sceneViewStateUse SceneView.SceneViewState to set the debug options for the Scene view.
showGridGets or sets whether to enable the grid for an instance of the SceneView.
sizeThe size of the Scene view measured diagonally.
validateTrueMetalsWhether the albedo is black for materials with an average specular color above 0.45.

Static Properties

Property

Description

currentDrawingSceneViewThe SceneView that is being drawn.
lastActiveSceneViewThe SceneView that was most recently in focus.
sceneViewsThe list of all open Scene view windows.
selectedOutlineColorGets the Color of selected outline.

Methods

Method

Description

AlignViewToObjectMoves the Scene view to frame a transform.
AlignWithViewAligns the current selection with the position and rotation of the Scene view SceneView.camera.
FrameFrames the given bounds in the Scene view.
FrameSelectedFrame the object selection in the Scene view.
IsCameraDrawModeEnabledReturns true if mode is enabled in the current rendering setup, including custom validators.
IsCameraDrawModeSupportedChecks if the current rendering configuration supports the SceneView.CameraMode. The check includes custom validators.
LookAtMoves the Scene view to focus on a target.
LookAtDirectSceneView.LookAt without animating the scene movement.
MoveToViewTransforms all selected object to the scene SceneView.pivot.
ResetCameraSettingsResets the SceneView.CameraSettings for the SceneView Camera to default.
SetSceneViewShaderReplaceSets a replacement shader for rendering this Scene view.
SupportsStageHandlingOverride this method to control whether the Scene view should change when you switch from one stage to another stage.

Static Methods

Method

Description

AddCameraModeAdd a custom camera mode to the Scene view camera mode list.
AddOverlayToActiveViewAdd an Overlay to be displayed in the last focused Scene View. Overlays added to this static list will be automatically moved to the last active Scene View, and are displayed until removed.
ClearUserDefinedCameraModesRemove all user-defined camera modes.
FrameLastActiveSceneViewFrames the currently selected object(s) in the last active Scene view.
GetAllSceneCamerasRetrieves an array of all SceneView.camera components from all open Scene views.
GetBuiltinCameraModeGets the built-in SceneView.CameraMode that matches the specified DrawCameraMode.
RemoveOverlayFromActiveViewRemove an Overlay from displaying in the last focused Scene View.
RepaintAllRepaints every open SceneView.

Events

Member

Description

gridVisibilityChangedInvoked when grid visibility changes.
onCameraModeChangedAn event that is invoked when the selected SceneView.cameraMode changes.
onValidateCameraModeA multicast delegate for custom render pipelines to specify support for a requested SceneView.CameraMode.

Static Events

Member

Description

beforeSceneGuiThe event issued when the OnGUI method is called.
duringSceneGuiSubscribe to this event to receive a callback whenever the Scene view calls the OnGUI method.

Classes

Class

Description

SceneView.CameraSettingsUse this class to set SceneView Camera properties.
SceneView.SceneViewStateA collection of graphic settings for this SceneView. All graphic settings are boolean.

Structs

Struct

Description

SceneView.CameraModeDescribes a built-in Scene view mode.

Inheritance

Inherited Members

Operators

Operator

Description

operator ==Compares two object references to see if they refer to the same object.
boolDetermines whether the object exists.
operator !=Compares if two objects refer to a different object.