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
- Type: Class
- Namespace: UnityEditor
- Assembly: UnityEditor
- Inherits from: SearchableEditorWindow
- Implements: IHasCustomMenu, ISupportsOverlays
[EditorWindowTitle(title = "Scene", useTypeNameAsIconName = true)]public class SceneView : SearchableEditorWindow, IHasCustomMenu, ISupportsOverlays
Static Fields
Value | Description |
|---|---|
| lastActiveSceneViewChanged | Register to this callback to get notified when the active Scene View changes. |
Properties
Property | Description |
|---|---|
| audioPlay | Enables or disables Scene view audio effects. |
| camera | The Camera that is rendering this SceneView. |
| cameraDistance | The distance from SceneView.camera to SceneView.pivot. |
| cameraMode | The current DrawCameraMode for the Scene view SceneView.camera. |
| cameraSettings | Use SceneView.CameraSettings to set the properties for the SceneView Camera. |
| cameraViewport | The position and size of the area that the camera renders. |
| drawGizmos | Sets the visibility of all Gizmos in the Scene view. |
| in2DMode | Whether the SceneView is in 2D mode. |
| isRotationLocked | Whether the Scene view SceneView.camera can be rotated. |
| isUsingSceneFiltering | Whether this SceneView is using scene filtering. |
| lastSceneViewRotation | When the Scene view is in 2D mode, this property contains the last SceneView.camera rotation. |
| orthographic | Whether the Scene view camera is set to orthographic mode. |
| pivot | The central point that the camera orbits within the Scene view. |
| rotation | The direction of the SceneView.camera to the SceneView.pivot of the SceneView. |
| sceneLighting | Whether lighting is enabled or disabled in the Scene view. |
| sceneViewState | Use SceneView.SceneViewState to set the debug options for the Scene view. |
| showGrid | Gets or sets whether to enable the grid for an instance of the SceneView. |
| size | The size of the Scene view measured diagonally. |
| validateTrueMetals | Whether the albedo is black for materials with an average specular color above 0.45. |
Static Properties
Property | Description |
|---|---|
| currentDrawingSceneView | The SceneView that is being drawn. |
| lastActiveSceneView | The SceneView that was most recently in focus. |
| sceneViews | The list of all open Scene view windows. |
| selectedOutlineColor | Gets the Color of selected outline. |
Methods
Method | Description |
|---|---|
| AlignViewToObject | Moves the Scene view to frame a transform. |
| AlignWithView | Aligns the current selection with the position and rotation of the Scene view SceneView.camera. |
| Frame | Frames the given bounds in the Scene view. |
| FrameSelected | Frame the object selection in the Scene view. |
| IsCameraDrawModeEnabled | Returns true if mode is enabled in the current rendering setup, including custom validators. |
| IsCameraDrawModeSupported | Checks if the current rendering configuration supports the SceneView.CameraMode. The check includes custom validators. |
| LookAt | Moves the Scene view to focus on a target. |
| LookAtDirect | SceneView.LookAt without animating the scene movement. |
| MoveToView | Transforms all selected object to the scene SceneView.pivot. |
| ResetCameraSettings | Resets the SceneView.CameraSettings for the SceneView Camera to default. |
| SetSceneViewShaderReplace | Sets a replacement shader for rendering this Scene view. |
| SupportsStageHandling | Override this method to control whether the Scene view should change when you switch from one stage to another stage. |
Static Methods
Method | Description |
|---|---|
| AddCameraMode | Add a custom camera mode to the Scene view camera mode list. |
| AddOverlayToActiveView | Add 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. |
| ClearUserDefinedCameraModes | Remove all user-defined camera modes. |
| FrameLastActiveSceneView | Frames the currently selected object(s) in the last active Scene view. |
| GetAllSceneCameras | Retrieves an array of all SceneView.camera components from all open Scene views. |
| GetBuiltinCameraMode | Gets the built-in SceneView.CameraMode that matches the specified DrawCameraMode. |
| RemoveOverlayFromActiveView | Remove an Overlay from displaying in the last focused Scene View. |
| RepaintAll | Repaints every open SceneView. |
Events
Member | Description |
|---|---|
| gridVisibilityChanged | Invoked when grid visibility changes. |
| onCameraModeChanged | An event that is invoked when the selected SceneView.cameraMode changes. |
| onValidateCameraMode | A multicast delegate for custom render pipelines to specify support for a requested SceneView.CameraMode. |
Static Events
Member | Description |
|---|---|
| beforeSceneGui | The event issued when the OnGUI method is called. |
| duringSceneGui | Subscribe to this event to receive a callback whenever the Scene view calls the OnGUI method. |
Classes
Class | Description |
|---|---|
| SceneView.CameraSettings | Use this class to set SceneView Camera properties. |
| SceneView.SceneViewState | A collection of graphic settings for this SceneView. All graphic settings are boolean. |
Structs
Struct | Description |
|---|---|
| SceneView.CameraMode | Describes a built-in Scene view mode. |
Inheritance
Operators
Operator | Description |
|---|---|
| operator == | Compares two object references to see if they refer to the same object. |
| bool | Determines whether the object exists. |
| operator != | Compares if two objects refer to a different object. |