Skip to main content

LinkedMesh

A class in Root.Township, the global namespace.

Builder component for chains of linked pieces: each link sits Length away from its Previous link and spawns one of its Prefabs as a child. Probably an editor tool for laying out ropes or fences.

Constructors​

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

Fields​

7 private and internal fields
MemberWhat it is
private GameObject childThe currently spawned prefab instance.
private bool isAddingChildSerialized flag that nothing in this class reads; probably used by an editor script.
private float lengthBacking field for Length.
private int oldIndexLast applied prefab index, so PrefabIndex only respawns when the value changes or the child is missing.
private int prefabIndexBacking field for PrefabIndex.
private GameObject[] prefabsBacking field for Prefabs.
private LinkedMesh previousBacking field for Previous.

Properties​

MemberWhat it is
float Length { get; set; }Distance this link keeps from Previous.
int PrefabIndex { get; set; }Which entry of Prefabs is spawned as the child. Setting it destroys the current child and spawns the new prefab at the local origin.
GameObject[] Prefabs { get; set; }Prefabs this link can show; PrefabIndex picks one.
LinkedMesh Previous { get; set; }The link before this one. Setting it moves this link Length away from it and turns it to face back along the chain.

Methods​

1 private and internal method
MemberWhat it is
private void EditorSafeDestroy(GameObject gameObject)Destroys the old child object through ObjectUtility.Destroy, used when PrefabIndex changes.