Vixen
02b45cc4
csharp
public record class ComponentGizmo

Lines drawn in the viewport for every entity carrying a component type.

Read the guide page for this →

Remarks

Doc 36 § D4's AddGizmo, whose "Replaces the hardcoding at" column said nothing. That was wrong and it is the useful part of building this: SceneLines.LightShapes is a walk over the scene testing for one component type and switching on its kind, which is exactly this mechanism written once, in the application's own assembly, for the one component the application happens to know about. A plugin's component had no way to be drawn at all.

⚠ SelectedOnly is Unity's GizmoType.Selected and it earns its place. A trigger volume drawn for every entity in a level is a scene nobody can see through; the same volume drawn for the one you clicked is the reason you clicked it. A gizmo that is cheap and always relevant — a light's reach — wants the default.

⚠ The component arrives boxed, which is the tooling path's price and not a mistake. One allocation per entity per frame per gizmo is what a runtime Type costs; Vixen.Core.Reflection's own remarks name the same trade for the inspector. A gizmo that needs to be free is a built-in that can be generic.

Fields and properties (4)

  • public Type Target

    The component or behaviour type. Every entity with one gets the lines.

  • public GizmoDrawer Draw

    What draws them.

  • public bool SelectedOnly

    Whether to draw only for entities in the selection.

  • public int Order

    Which of two gizmos draws first, low first.

Methods (1)

  • public ComponentGizmo(Type Target, GizmoDrawer Draw, bool SelectedOnly = false, int Order = 0)

    Lines drawn in the viewport for every entity carrying a component type.

Used by (4)

  • ComponentGizmoTestsVixen.Editor.SceneView.Tests
  • ComponentGizmosVixen.Editor.SceneView
  • DeclaredContributionTestsVixen.Editor.App.Tests
  • DeclaredContributionsVixen.Editor.App