Version: 2020.1
언어: 한국어

DrawGizmoConstructor

매뉴얼로 전환
public DrawGizmo (GizmoType gizmo);

파라미터

gizmo Flags to denote when the gizmo should be drawn.

설명

Defines when the gizmo should be invoked for drawing.

See Also: GizmoType, DrawGizmo.

using UnityEngine;
using UnityEditor;

// Draw an image above the light when the light is not selected // The icon has to be stored in Assets/Gizmos

public class ExampleScript : MonoBehaviour { // Draw an image above the light when the light is not selected [DrawGizmo(GizmoType.NotInSelectionHierarchy | GizmoType.Pickable)] static void drawGizmo1(Light light, GizmoType gizmoType) { Vector3 position = light.transform.position;

Gizmos.DrawIcon(position + Vector3.up, "ninja.jpg"); }

// Place a red sphere around a selected light. // Surround the sphere dark shaded when not selected. [DrawGizmo(GizmoType.Selected | GizmoType.NonSelected)] static void drawGizmo2(Light light, GizmoType gizmoType) { Vector3 position = light.transform.position;

if ((gizmoType & GizmoType.Selected) != 0) { Gizmos.color = Color.red; } else { Gizmos.color = Color.red * 0.5f; } Gizmos.DrawSphere(position , 1); } }

public DrawGizmo (GizmoType gizmo, Type drawnGizmoType);

파라미터

gizmo Flags to denote when the gizmo should be drawn.
drawnGizmoType Type of object for which the gizmo should be drawn.

설명

Same as above. drawnGizmoType determines of what type the object we are drawing the gizmo of has to be.

If drawnGizmoType is null, the type will be determined from the first parameter of the draw gizmo method. If drawnGizmoType is not null, it must be the same type as, or a subtype of, the type of the first parameter.

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