ArrowHandleCapLike SaintsArrow but using Unity's default ArrowHandleCap to draw. (No dependency required)
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.Space startSpace = Space.World: if the start is aVector3/Vector2, should it be in world space or local space.string 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.Space endSpace = Space.World: if the end is aVector3/Vector2, should it be in world space or local space.EColor 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.
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.
Example:
using SaintsField; [SerializeField, GetComponent, DrawLabel("Entrance"), // connect this to worldPos[0] ArrowHandleCap(end: nameof(worldPos), endIndex: 0), ] private GameObject entrance; [ // connect every element in the list ArrowHandleCap(eColor: EColor.Green), // connect every element to the `centerPoint` ArrowHandleCap(end: nameof(centerPoint), eColor: EColor.Red), 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 ArrowHandleCap(start: nameof(worldPos), startIndex: -1), ] public Transform exit; private string PosIndexLabel(Vector3 pos, int index) => quot;[{index}]\n{pos}";
