Unity3D圣典3.3版本-中文版
文集大纲加载中……
本文档使用 MrDoc 发布
-
+
首页
DrawGizmo.DrawGizmo 构造 DrawGizmo
# [DrawGizmo](DrawGizmo.html).DrawGizmo 构造 DrawGizmo static function *DrawGizmo* (*gizmo* : [GizmoType](../Editor_Enumerations/GizmoType/GizmoType.html)) : DrawGizmo *Description* 描述 Defines when the gizmo should be invoked for drawing. 当 gizmo 应该绘制调用时定义。 参见:[GizmoType](../Editor_Enumerations/GizmoType/GizmoType.html) ``` /// The RenderLightGizmo function will be called if the light is not selected. /// The gizmo is drawn when picking. ///如果灯光不选择RenderLightGizmo函数将被调用 ///当点选时gizmo被绘制 @DrawGizmo (GizmoType.NotSelected | GizmoType.Pickable) static function RenderLightGizmo (light : Light, gizmoType : GizmoType) { var position = light.transform.position; // Draw the light icon //绘制灯光图标 // (A bit above the one drawn by the builtin light gizmo renderer) Gizmos.DrawIcon (position + Vector3.up, "Light Gizmo.tiff"); // Are we selected? Draw a solid sphere surrounding the light //当选择时,围绕灯光绘制一个球形 if ((gizmoType & GizmoType.SelectedOrChild) != 0) { // Indicate that this is the active object by using a brighter color. //使用明亮的颜色,表明这是激活的物体 if ((gizmoType & GizmoType.Active) != 0) Gizmos.color = Color.red; else Gizmos.color = Color.red * 0.5; Gizmos.DrawSphere (position, light.range); } } /* // Draw the gizmo if it is selected or a child of the selection. // This is the most common way to render a gizmo //如果它或它的子物体被选择,绘制gizmo;这是最常用的渲染gizmo方法 @DrawGizmo (GizmoType.SelectedOrChild) // Draw the gizmo only if it is the active object. //仅绘制激活物体的gizmo @DrawGizmo (GizmoType.Active)] */ ``` ``` /// C# example using UnityEditor; using UnityEngine; class GizmoTest { /// The RenderLightGizmo function will be called if the light is not selected. /// The gizmo is drawn when picking. [DrawGizmo (GizmoType.NotSelected | GizmoType.Pickable)] static void RenderLightGizmo (Light light, GizmoType gizmoType) { Vector3 position = light.transform.position; // Draw the light icon // (A bit above the one drawn by the builtin light gizmo renderer) Gizmos.DrawIcon (position + Vector3.up, "Light Gizmo.tiff"); // Are we selected? Draw a solid sphere surrounding the light if ((gizmoType & GizmoType.SelectedOrChild) != 0) { // Indicate that this is the active object by using a brighter color. if ((gizmoType & GizmoType.Active) != 0) Gizmos.color = Color.red; else Gizmos.color = Color.red * 0.5F; Gizmos.DrawSphere (position, light.range); } } } /* // Draw the gizmo if it is selected or a child of the selection. // This is the most common way to render a gizmo [DrawGizmo (GizmoType.SelectedOrChild)] // Draw the gizmo only if it is the active object. [DrawGizmo (GizmoType.Active)] */ ``` • static function *DrawGizmo* (*gizmo* : [GizmoType](../Editor_Enumerations/GizmoType/GizmoType.html), *drawnGizmoType* : Type) : DrawGizmo *Description* 描述 Same as above. drawnGizmoType determines of what type the object we are drawing the gizmo of has to be. 同上。drawnGizmoType 确定了要绘制 gizmo 物体是什么类型。 If drawnGizmoType is null, the type will be determined from the first parameter of the draw gizmo method. 如果 drawnGizmoType 类型为 null,该类型将从绘制 gizmo 方法的首个参数来确定。
da
2022年5月19日 23:06
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
关于 MrDoc
觅思文档MrDoc
是
州的先生
开发并开源的在线文档系统,其适合作为个人和小型团队的云笔记、文档和知识库管理工具。
如果觅思文档给你或你的团队带来了帮助,欢迎对作者进行一些打赏捐助,这将有力支持作者持续投入精力更新和维护觅思文档,感谢你的捐助!
>>>捐助鸣谢列表
微信
支付宝
QQ
PayPal
Markdown文件
分享
链接
类型
密码
更新密码