Skip to main content

StaticPositionSpawner

A class in Root.Township, the global namespace.

Local decoration spawner: when enabled, instantiates a random non-networked prefab at each point of the SpawnPositions on the same object, and removes them when disabled.

Constructors​

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

Fields​

2 private and internal fields
MemberWhat it is
private SpawnPositions positionsThe SpawnPositions on this object.
private GameObjectDistribution staticPrefabsDistribution the prefabs are picked from.

Methods​

3 private and internal methods
MemberWhat it is
private void Awake()Caches the SpawnPositions component.
private void OnDisable()Destroys all child objects, including the spawned prefabs.
private void OnEnable()Spawns a random prefab from staticPrefabs at each spawn point.