Version: 2023.2

HandleUtility

class in UnityEditor

切换到手册

描述

适用于场景视图样式 3D GUI 的 Helper 函数。

These are mainly mathematical functions that assist in converting between the 3D Scene space and the 2D GUI. The functions are used in the construction of the Unity Editor itself and so using them is a good way to make your own Handles GUIs consistent with Unity's.

静态变量

acceleration获取用于拖动值的标准加速度(只读)。
niceMouseDelta获取用于拖动浮点值的精密鼠标增量(只读)。
niceMouseDeltaZoom获取用于缩放的精密鼠标增量(只读)。

静态函数

AddControl记录从手柄到测量点的距离。
AddDefaultControl为默认控件添加 ID。如果没有其他控件可选,则选择此控件。
CalcLineTranslation将鼠标拖动映射到沿 3D 空间中一条直线的运动。
ClosestPointToArc获取弧线(在 3D 空间中)上最接近当前鼠标位置的点。
ClosestPointToDisc获取圆盘(在 3D 空间中)上最接近当前鼠标位置的点。
ClosestPointToPolyLine获取折线(在 3D 空间中)上最接近当前鼠标位置的点。
DistancePointBezier计算点与贝塞尔曲线之间的距离。
DistancePointLine计算点与线之间的距离。
DistancePointToLine从 2d 中的一个点 p 到由两个点 a 和 b 定义的一条直线的距离。
DistancePointToLineSegment从 2d 中的一个点 p 到由两个点 a 和 b 定义的线段的距离。
DistanceToArcReturns the distance in pixels from the mouse pointer to a 3D section of a disc.
DistanceToCircleReturns the distance in pixels from the mouse pointer to a camera facing circle.
DistanceToConeReturns the distance in pixels from the mouse pointer to a cone.
DistanceToCubeReturns the distance in pixels from the mouse pointer to a cube.
DistanceToDiscReturns the distance in pixels from the mouse pointer to a 3D disc.
DistanceToLineReturns the distance in pixels from the mouse pointer to a line.
DistanceToPolyLineReturns the distance in pixels from the mouse pointer to a polyline.
DistanceToRectangleReturns the distance in pixels from the mouse pointer to a rectangle on screen.
FindNearestVertexReturns the nearest vertex to a guiPoint within a maximum radius of 50 pixels.
GetHandleSize获取给定位置处操控器手柄的世界空间大小。
GetPickingIncludeExcludeListGets the picking PickingIncludeExcludeList for the currently executing BatchRendererGroup.OnPerformCulling callback.
GetSelectionOutlineIncludeExcludeListGets the selection outline PickingIncludeExcludeList for the currently executing BatchRendererGroup.OnPerformCulling callback.
GUIPointToScreenPixelCoordinate将 2D GUI 位置转换为屏幕像素坐标。
GUIPointToWorldRay将 2D GUI 位置转换为世界空间射线。
PickGameObject选择最接近指定位置的游戏对象。
PickRectObjects选择位于指定屏幕矩形内的游戏对象。
PlaceObjectCasts a ray against the loaded scenes and returns the nearest intersected point on a collider.
PointOnLineParameter返回给定线上 point 投影的参数。
PopCamera检索所有摄像机设置。
ProjectPointLine将 point 投射到一条直线上。
PushCamera存储所有摄像机设置。
RaySnapCasts ray against the Scene and reports whether an object lies in its path.
Repaint重新绘制当前视图。
WorldPointToSizedRect计算一个用于在 3D 空间中投影点附近显示 2D GUI 元素的矩形。
WorldToGUIPoint将世界空间点转换为 2D GUI 位置。
WorldToGUIPointWithDepth将世界空间点转换为 2D GUI 位置。

Events

getAuthoringObjectForEntityThe user-defined callback that Unity uses to retrieve the Unity Object associated with a DOTS Entity.
getEntitiesForAuthoringObjectThe user-defined callback that Unity uses to retrieve the DOTS Entity IDs associated with a Unity Object.
pickGameObjectCustomPassesSubscribe to this event to add additional picking objects to the HandleUtility.PickGameObject method.
placeObjectCustomPassesSubscribe to this event to handle object placement in the SceneView.

委托

PickGameObjectCallbackThis is the method definition for pickGameObjectCustomPasses.
PlaceObjectDelegateThis is the method definition for placeObjectCustomPasses.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961