public sealed class DrawGizmoAttributeMarks a static method as the gizmo for a component type.
As a annotation
- Valid on
- Method
Remarks
Doc 36 § D3, and Unity's [DrawGizmo]. The method is what Draw takes.
[DrawGizmo(typeof(SpawnPoint), SelectedOnly = true)] public static void Draw(GizmoDraw draw, object component, GizmoPlacement placement, bool selected) { draw.Sphere(placement.Position, ((SpawnPoint) component).Radius, new(0.2f, 0.9f, 0.4f, 1f)); }
⚠ The component is Object rather than the target type, and casting it is the author's line. A typed delegate would need the attribute to be generic, which an attribute cannot be over a type argument the scanner discovers at run time. The cast is checked — the drawer is only ever called for an entity carrying Target.
⚠ Read by a scan of the assembly that declared it, and only for a plugin or a project script — see CustomInspectorAttribute for why that is bounded rather than the assembly scanning ADR-002 refuses. In-tree code registers a ComponentGizmo directly.
Fields and properties (3)
public Type TargetThe type it draws for.
public bool SelectedOnlyWhether to draw only for entities in the selection.
public int OrderWhich of two gizmos draws first, low first.
Methods (1)
public DrawGizmoAttribute(Type target)Marks a static method as the gizmo for a component type.
Used by (1)
- DeclaredContributionsVixen.Editor.App