A class in Root.Township, the global namespace.
Networked, saved part that clones its last copy in a row with a fixed offset and rotation, up to a count. The server syncs the count to clients.
Constructors
| Member | What it is |
|---|
LinearPartCloner() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
8 private and internal fields
| Member | What it is |
|---|
private bool isOffsetRelativeToLast | When true the offset is in the last copy's local space, otherwise added to its local position. |
private Transform last | The latest copy, cloned for the next one. Nothing in this file sets it first, so template looks unused. |
private Vector3 offset | Position offset from one copy to the next. |
private Vector3 rotation | Extra rotation (Euler) for each copy. |
private LinearPartClonerData saveData | Saved data holding the count. |
private int spawnedCount | How many parts exist, counting the original. |
private MethodSync sync | Method sync for the count (SyncCount). |
private Transform template | Not read in this file. |
Methods
| Member | What it is |
|---|
override void Initialize() | Sets up the count sync. |
override void OnConnected(Player player) | Sends the current count to a joining player. |
void Spawn(int count) | Sets the count and clones copies until it is reached. Server: also sends the count to clients. Copies are hidden and not saved. |
3 private and internal methods
| Member | What it is |
|---|
private void OnValidate() | Editor: respawns copies on a prefab instance when the count changed. |
private void Regenerate() | Editor context menu: respawns copies on a prefab instance. |
private void SyncCount(IPlayer player, Stream stream) | Writes the count (1 to 255) or, on a client, reads it and spawns copies. |
Used in
Members of other types that take, return or hold a LinearPartCloner: