DrawLineDraw 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.nullfor the current field.int startIndex = 0: whenstartis notnull, 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,nullmeans using the world space, otherwise means using a callback or a field valuestring end = null: where does the line end.nullfor the current field.int endIndex = 0: whenendis notnull, 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,nullmeans using the world space, otherwise means using a callback or a field valueEColor eColor = EColor.White: colorfloat alpha = 1f: the alpha of the color. Not works withcolor.string color = null: the color of the line. If it starts with#, use html hex color, otherwise use as a callback. This overrides theeColor.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 fieldint 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,nullmeans using the world space, otherwise means using a callback or a field valuestring space = "this": the containing space."this"means using the current target,nullmeans using the world space, otherwise means using a callback or a field valueEColor eColor = EColor.White: colorfloat alpha = 1f: the alpha of the color. Not works withcolor.string color = null: the color of the line. If it starts with#, use html hex color, otherwise use as a callback. This overrides theeColor.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}";
