Version: 2019.1

DrawGizmoConstructor

Switch to Manual
public DrawGizmo (GizmoType gizmo);

Parameters

gizmo@param gizmo Флаги для обозначения, когда гизмо должен быть отрисован.

Description

Определяет, когда гизмо должен быть вызван для отрисовки.

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);

Parameters

gizmo@param gizmo Флаги для обозначения, когда гизмо должен быть отрисован.
drawnGizmoType@param drawnGizmoType Тип объекта, для которого гизмо должен быть отрисован.

Description

То же, что и выше. drawnGizmoType устанавливает, какой тип объекта должен отрисовывать гизмо.

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.