SaintsArrowNote: this feature requires SaintsDraw 4.0.5 installed
Draw an arrow between different objects. The decorated field need to be a GameObject/Component or a Vector3/Vector2, or a list/array of them.
Parameters:
string start = null: where does the arrow 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 arrow 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.float headLength = 0.5f: the length of the arrow head.float headAngle = 20.0f: the angle of the arrow head.
Specially
- using on an array/list without specifying
startandendwill arrow-connect the element from first to last. startIndex&endIndexcan be negative, which means to count from the end.-1means the last element.
A complex showcase:
using SaintsField; [SerializeField, GetComponent, DrawLabel("Entrance"), // connect this to worldPos[0] SaintsArrow(end: nameof(worldPos), endIndex: 0, endSpace: Space.Self), ] private GameObject entrance; [ // connect every element in the list SaintsArrow(color: EColor.Green, startSpace: Space.Self, headLength: 0.1f), // connect every element to the `centerPoint` SaintsArrow(start: nameof(centerPoint), color: EColor.Red, startSpace: Space.Self, endSpace: Space.Self, headLength: 0.1f, colorAlpha: 0.4f), PositionHandle, DrawLabel("quot; + nameof(PosIndexLabel)), ] public Vector3[] worldPos; [DrawLabel("Center"), PositionHandle] public Vector3 centerPoint; [DrawLabel("Exit"), GetComponentInChildren(excludeSelf: true), PositionHandle, // connect worldPos[0] to this SaintsArrow(start: nameof(worldPos), startIndex: -1, startSpace: Space.Self), ] public Transform exit; private string PosIndexLabel(Vector3 pos, int index) => quot;[{index}]\n{pos}";