SceneView

class in UnityEditor

/

Inherits from:EditorWindow


Implements interfaces:IHasCustomMenu

Switch to Manual

Description

Use this class to manage SceneView settings, change the SceneView camera properties, subscribe to events, call SceneView methods, and render open scenes.

Static Variables

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

Variables

cameraThe Camera that is rendering this SceneView.
cameraDistanceThe distance from camera to pivot.
cameraModeThe current DrawCameraMode for the Scene view camera.
in2DModeWhether the SceneView is in 2D mode.
isRotationLockedWhether the Scene view camera can be rotated.
lastSceneViewRotationWhen the Scene view is in 2D mode, this property contains the last camera rotation.
m_AudioPlayM_AudioPlay has been deprecated. Use audioPlay instead (UnityUpgradable) -> audioPlay.
m_ValidateTrueMetalsM_ValidateTrueMetals has been deprecated. Use validateTrueMetals instead (UnityUpgradable) -> validateTrueMetals.
orthographicWhether the Scene view camera is set to orthographic mode.
pivotThe center point, or pivot, of the Scene view.
rotationThe direction of the camera to the pivot of the SceneView.
sceneViewStateUse SceneViewState to set the debug options for the Scene view.
sizeThe size of the Scene view measured diagonally.

Public Functions

AlignViewToObjectMoves the Scene view to frame a transform.
AlignWithViewAligns the current selection with the position and rotation of the Scene view 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.
LookAtMoves the Scene view to focus on a target.
LookAtDirect LookAt without animating the scene movement.
MoveToViewTransforms all selected object to the scene pivot.
SetSceneViewShaderReplaceSets a replacement shader for rendering this Scene view.

Protected Functions

SupportsStageHandlingOverride this method to control whether the Scene view should change when you switch from one stage to another stage.

Static Functions

AddCameraModeAdd a custom camera mode to the Scene view camera mode list.
ClearUserDefinedCameraModesRemove all user-defined camera modes.
FrameLastActiveSceneViewFrames the currently selected object(s) in the last active Scene view.
GetAllSceneCamerasRetrieves an array of all camera components from all open Scene views.
GetBuiltinCameraModeGets the built-in CameraMode that matches the specified DrawCameraMode.
RepaintAllRepaints every open SceneView.

Events

onCameraModeChangedAn event that is invoked when the selected cameraMode changes.

Inherited members

Static Variables

focusedWindow当前已获得键盘焦点的 EditorWindow。(只读)
mouseOverWindow当前在鼠标光标下的 EditorWindow。(只读)

Variables

autoRepaintOnSceneChangeDoes the window automatically repaint whenever the Scene has changed?
maximized此窗口是否已最大化?
maxSize此窗口的最大大小。
minSize此窗口的最小大小。
position窗口在屏幕空间中的理想位置。
titleContent用于绘制 EditorWindow 标题的 GUIContent。
wantsMouseEnterLeaveWindow检查是否已在此编辑器窗口的 GUI 中收到 MouseEnterWindow 和 MouseLeaveWindow 事件。
wantsMouseMove检查是否已在此编辑器窗口的 GUI 中收到 MouseMove 事件。
hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?
name对象的名称。

Public Functions

BeginWindows标记所有弹出窗口的开始区域。
Close关闭编辑器窗口。
EndWindows关闭由 EditorWindow.BeginWindows 开始的窗口组。
Focus将键盘焦点移动到另一个 EditorWindow。
RemoveNotification停止显示通知消息。
Repaint重绘窗口。
SendEvent将事件发送到窗口。
Show显示 EditorWindow 窗口。
ShowAsDropDown显示包含下拉菜单和样式的窗口。
ShowAuxWindow在辅助窗口中显示编辑器窗口。
ShowNotification显示通知消息。
ShowPopup使用弹出式框架显示编辑器窗口。
ShowUtility将 EditorWindow 显示为浮动实用程序窗口。
GetInstanceID返回对象的实例 ID。
ToString返回 GameObject 的名称。

Static Functions

FocusWindowIfItsOpen聚焦发现的第一个指定类型的 EditorWindow(如果已打开)。
GetWindow返回当前屏幕上第一个 t 类型的 EditorWindow。
GetWindowWithRect返回当前屏幕上第一个 t 类型的 EditorWindow。
Destroy删除 GameObject、组件或资源。
DestroyImmediate立即销毁对象 /obj/。强烈建议您改用 Destroy。
DontDestroyOnLoadDo not destroy the target Object when loading a new Scene.
FindObjectOfType返回第一个类型为 type 的已加载的激活对象。
FindObjectsOfType返回所有类型为 type 的已加载的激活对象的列表。
Instantiate克隆 original 对象并返回克隆对象。
CreateInstance创建脚本化对象的实例。

Operators

bool该对象是否存在?
operator !=比较两个对象是否引用不同的对象。
operator ==比较两个对象引用,判断它们是否引用同一个对象。

Messages

Awake在新窗口打开时调用。
OnDestroy调用 OnDestroy 以关闭 EditorWindow 窗口。
OnFocus在窗口获得键盘焦点时调用。
OnGUI在此处实现您自己的 Editor GUI。
OnHierarchyChange处理程序,用于在层级视图中的对象或对象组发生更改时发送的消息。
OnInspectorUpdateOnInspectorUpdate 以每秒 10 帧的速度调用,以便检视面板有机会进行更新。
OnLostFocus在窗口失去键盘焦点时调用。
OnProjectChange处理程序,用于在项目状态发生更改时发送的消息。
OnSelectionChange每当选择发生更改时调用。
Update在所有可见窗口上每秒调用多次。
Awake当 ScriptableObject 脚本启动时调用此函数。
OnDestroy当脚本化对象将销毁时调用此函数。
OnDisable当脚本化对象超出范围时调用此函数。
OnEnable当对象加载时调用此函数。