Hide
ArrowHandleCap

Like 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. 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.
  • Space startSpace = Space.World: if the start is a Vector3/Vector2, should it be in world space or local space.
  • string end = null: where does the arrow 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.
  • Space endSpace = Space.World: if the end is a Vector3/Vector2, should it be in world space or local space.
  • 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.

Specially

  1. using on an array/list without specifying start and end will arrow-connect the element from first to last.
  2. startIndex & endIndex can be negative, which means to count from the end. -1 means 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}";

image