Skip to main content

InGameLineGizmo

A class in Root.Township, the global namespace.

Pooled line drawn in the game world between two points, made by InGameGizmosSettings.DrawLine. Its ends can follow transforms.

Constructors​

MemberWhat it is
InGameLineGizmo()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

6 private and internal fields
MemberWhat it is
private Transform fromStart marker transform.
private Vector3 lastFromLast known start position.
private Vector3 lastToLast known end position.
private Material materialThe line's own material copy.
private LineRenderer rendererThe line renderer.
private Transform toEnd marker transform.

Methods​

MemberWhat it is
void SetPositions(Vector3 from, Vector3 to)Places the ends at two world points, or parents them to two transforms with local offsets so they follow.
void SetPositions(Transform from, Transform to, Vector3 offsetFrom, Vector3 offsetTo)Places the ends at two world points, or parents them to two transforms with local offsets so they follow.
3 private and internal methods
MemberWhat it is
private void Awake()Sets the line to two points and gives it its own material copy.
private void RequestedSetup(PooledObject pooledObject)Runs when taken from the pool. Tints the line with InGameGizmosSettings.Color.
private void Update()Draws the line between the end markers. If a followed transform was destroyed, keeps the end at its last spot.