Skip to main content

Spawners

Spawners can be used to spawn large numbers of entities.

Sphere Spawner

SpawnerAuthoring can be attached to a game object to spawn entities in random positions of some spherical area. The system responsible for this is the SpawnerSystem. It spawns the entities in a radius around the game object with SpawnerAuthoring.

You can set the following properties on SpawnerAuthoring.

  • Prefab - Prefab of an entity to spawn.
  • Count - How many to spawn.
  • Radius - Radius of the area where entities can spawn.
  • PositionMask - Multiplier for the random positions - for example float3(1, 0, 1) will make a circle, float3(1, 1, 1) a sphere and float3(1, 0.1, 1) would make a sphere squashed on y axis.

Rect Spawner

RectSpawnerAuthoring can be attached to a game object to spawn entities evenly distributed inside a rectangular area. The system which does this is the RectSpawnerSystem. It spawns the entities in a rectangular area around the game object with RectSpawnerAuthoring.

You can set the following properties on RectSpawnerAuthoring.

  • Prefab - Prefab of an entity to spawn.
  • Count - How many to spawn.
  • Size - Size of the rectangle.