Hide
SaintsArrow

Note: 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. 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 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.
  • 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.
  • float headLength = 0.5f: the length of the arrow head.
  • float headAngle = 20.0f: the angle of the arrow head.

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.

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}";