Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

prefab.from_population (procNode)

A prefab: a root plus one child carrying a population of instances as one Asset reference, so the record count is constant at any instance count. Use it for foliage, debris and crowds of copies; prefab.from_instances makes an entity per copy instead.

Inputs

  • instances (Points). The instanced draw the single child references: points carrying Mesh. Whatever persists or spawns the prefab folds the whole placement into one population asset, so the prefab stays two records whether the points number ten or a million.
  • name (String, default "population"). The root entity's name; the single child carrying the draw is named <name>_draw. An empty string takes "population".

Outputs

  • prefab (Prefab). Two records: the root (id "0") and the child (id "1") holding an Asset component.
local spots = g.points.grid({ countX = 2, countZ = 1 })
local field = g.prefab.from_population({ instances = g.instances.on_points({ source = g.mesh.box({}), points = spots }) })