Skip to main content

InGameSphereGizmo

A class in Root.Township, the global namespace.

Pooled sphere drawn in the game world, made by InGameGizmosSettings.DrawSphere. It can follow a transform.

Constructors​

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

Fields​

4 private and internal fields
MemberWhat it is
private Vector3 lastTargetLast known target position.
private Material materialThe sphere's own material copy.
private Transform rendererTransformTransform of the sphere mesh, scaled and moved each frame.
private Transform targetMarker transform the sphere sits on.

Methods​

MemberWhat it is
void SetPosition(Vector3 target, float radius)Places the sphere at a world point, or parents its target to a transform with an offset, and sets the radius.
void SetPosition(Transform target, float radius, Vector3 offset)Places the sphere at a world point, or parents its target to a transform with an offset, and sets the radius.
4 private and internal methods
MemberWhat it is
private void Awake()Gives the sphere its own material copy.
private void RequestedSetup(PooledObject pooledObject)Runs when taken from the pool. Tints the sphere with InGameGizmosSettings.Color.
private void SetRadius(float radius)Scales the sphere mesh to the given radius.
private void Update()Moves the mesh to the target. If a followed transform was destroyed, stays at its last spot.