Skip to main content

SpawnInCircle

A class in Root.Township, the global namespace.

Server: spawns items from a pipeline in a ring around the entity on first generation, as saved children.

Constructors​

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

Fields​

6 private and internal fields
MemberWhat it is
private ObjectPipeline itemsObject pipeline that picks the prefab for each item.
private float maxRadiusLargest ring radius.
private float minRadiusSmallest ring radius.
private int numOfItemsHow many items to place round the ring.
private Vector3 randomOffsetExtra random X and Z jitter per item.
private bool shouldBeKinematicMakes the spawned items' rigidbodies kinematic.

Methods​

MemberWhat it is
void CircleSpawn()Spawns about numOfItems items spaced round a circle at random radii and offsets, with random Y rotation.
override void InitializeAsServer(SpawnData spawnData)Spawns the ring when the spawn data says this is a fresh generation.