Hide
DrawLine

Draw a line between different objects. The decorated field need to be a GameObject/Component or a Vector3/Vector2, or a list/array of them.

You can use right click to show/hide handles.

Parameters:

  • string start = null: where does the line start. null for the current field.
  • int startIndex = 0: when start is not null, and the start is a list/array, specify the index of the start.
  • string startSpace = "this": the containing space. "this" means using the current target, null means using the world space, otherwise means using a callback or a field value
  • string end = null: where does the line end. null for the current field.
  • int endIndex = 0: when end is not null, and the end is a list/array, specify the index of the end.
  • string endSpace = "this": the containing space. "this" means using the current target, null means using the world space, otherwise means using a callback or a field value
  • EColor eColor = EColor.White: color
  • float alpha = 1f: the alpha of the color. Not works with color.
  • string color = null: the color of the line. If it starts with #, use html hex color, otherwise use as a callback. This overrides the eColor.
  • float dotted = -1f: when >=0, draw dotted line instead.

And also DrawLineFrom, DrawLineTo as a shortcut to connect current field with another:

  • string target = null: target point of the line from current field
  • int targetIndex = 0: if the target is a list/array, specify the index of the target.
  • string targetSpace = "this": the containing space. "this" means using the current target, null means using the world space, otherwise means using a callback or a field value
  • string space = "this": the containing space. "this" means using the current target, null means using the world space, otherwise means using a callback or a field value
  • EColor eColor = EColor.White: color
  • float alpha = 1f: the alpha of the color. Not works with color.
  • string color = null: the color of the line. If it starts with #, use html hex color, otherwise use as a callback. This overrides the eColor.
  • float dotted = -1f: when >=0, draw dotted line instead.
using SaintsField; [SerializeField, GetComponent, DrawLabel("Entrance"), // connect this to worldPos[0] DrawLineTo(target: nameof(localPos), targetIndex: 0, targetSpace: Space.Self), ] private GameObject entrance; [ // connect every element in the list DrawLine(color: EColor.Green, endSpace: Space.Self), // connect every element to the `centerPoint` DrawLineTo(target: nameof(centerPoint), color: EColor.Red, colorAlpha: 0.4f), DrawLabel("
quot;
+ nameof(PosIndexLabel)), ] public Vector3[] localPos; [DrawLabel("Center")] public Vector3 centerPoint; [DrawLabel("Exit"), GetComponentInChildren(excludeSelf: true), // connect worldPos[0] to this DrawLineFrom(target: nameof(localPos), targetIndex: -1, targetSpace: Space.Self), ] public Transform exit; private string PosIndexLabel(Vector3 pos, int index) =>
quot;[
{index}]\n{pos}";

image