Skip to content

Plants (Flora)

Plants are simulated by the GrowthAgent component. It handles ageing, visual growth, seeding (propagation) with local-density limits, and optional pollination boosts triggered by nearby pollinators.

This page covers prefab setup, parameters, editor seeding behavior, and practical balancing tips.

In this article


Prerequisites

  • Terrain is generated and Water Level is set.
  • You have at least one mesh/model you want to use as a plant.

Tip

For reliable proximity detection, add a small trigger collider (e.g., sphere radius 0.4–1.0) to the plant root. This is cheap and improves seeding/foraging queries.


Quick start

  1. Create an empty GameObject in the scene.
  2. Add GrowthAgent.
  3. Parent your plant model under it and reset local transform (0,0,0 / 1,1,1).
  4. (Optional) Set Tag = Plant and place a trigger collider on the root.
  5. Tune Growth and Seeding fields (see tables below).
  6. Drag the root object to Project to make a prefab.
  7. In the Flora tab of the editor, add this prefab with a ratio → Spawn.

GrowthAgent inspector


Prepare a plant prefab

Hierarchy Plant_Root (with GrowthAgent + trigger collider + Tag=Plant) └── Model (mesh, materials, LODs as needed) Root Transform - Keep scale 1,1,1 on the root; GrowthAgent applies a visual scale curve over time. - Keep pivots sensible (Y=0 at the ground) to avoid floating/sinking visuals.

Colliders - Prefer a single small trigger on the root for overlap checks; detailed colliders on the model are unnecessary.


GrowthAgent fields

Growth

Field What it does Typical range Notes
Max Age (days) Plant lifetime 100–300 When exceeded, plant despawns
Maturity (days) Time to become “mature” 5–20 Seeding usually requires maturity
Growth Rate Visual scale rate (per day) 0.6–1.4 Combined with internal lerp to clamp
Start Scale Initial visual scale (0–1) 0.2–0.4 Early seedlings look smaller
Max Scale Max visual scale multiplier 1.0–1.3 Caps the look when fully grown

Note

Visual growth doesn’t change collider size by default. Use the trigger only for proximity; don’t rely on it for visuals.

Seeding

Field What it does Typical range Notes
Seed Chance (per day) Probability to attempt a seed 0.02–0.08 Lower for slow spread, higher for lush
Seed Radius (m) Scatter distance for offspring 3–7 Wider for shrubs/grassland feel
Max Local Density Limit of same-species neighbors 5–10 Prevents clumping/runaway growth
Min Height / Max Height Allowed world height band terrain-dependent Skip underwater or too-high cliffs
Slope Limit Optional slope filter 20–40° Avoids placing on steep faces

Seeding & density

  • When a mature plant passes its Seed Chance, it attempts to spawn a new plant at a random point within Seed Radius.
  • Before spawning, it checks local density (same-species within a radius). If the area is saturated (≥ Max Local Density), the attempt is skipped.
  • Height/slope filters gate the placement to sensible terrain.

Tip

If the world looks barren, increase Seed Chance slightly or lower Max Local Density thresholds. If it explodes, do the opposite and reduce Seed Chance.


Pollination boost

Pollinators (animals with the Pollinator role) “visit” plants non-destructively: - The visit restores the pollinator’s energy, and then the animal lingers on the ground for N seconds (e.g., 30s), creating a predator window. - The plant can receive a temporary boost (e.g., +seed chance or +growth) for a short time window.

How it’s triggered

  • When a pollinator is within interaction distance of a plant, the animal sends a visit event to the plant (e.g., RegisterPollinationVisit(strength, lingerSeconds) or a fallback OnPollinated message).
  • GrowthAgent can accumulate a short-lived pollination multiplier (e.g., +10–30%) that decays over time.

Non-destructive visits

Pollinator visits do not destroy the plant. Herbivores, in contrast, consume and remove the plant object.

Suggested starting values

  • Pollination Strength: 1.0
  • Boost Duration: 20–40s
  • Boost Effect: +10–30% to effective Seed Chance (or +X to a growth accumulator)

Editor seeding integration

  • In the Flora tab, each plant prefab gets a ratio (weight). The seeding tool uses ratios to distribute plants across valid terrain.
  • Underwater areas are skipped by default based on Water Level.
  • If you regenerate terrain afterwards, re-seed or allow runtime propagation to fill in.

Checklist before Spawn - [ ] Plant prefab has GrowthAgent on root
- [ ] Small trigger collider on root
- [ ] Optional Tag = Plant (helps fallbacks)
- [ ] Height/slope filters match your terrain
- [ ] Ratios sum up sensibly across species


Balancing & examples

Grass (fast spreader)

  • Seed Chance: 0.06–0.08
  • Seed Radius: 3–4
  • Max Local Density: 8–10
  • Max Age: 120, Maturity: 6–8 days
  • Use case: quick ground cover; supports herbivores.

Flower (pollination-friendly)

  • Seed Chance: 0.03–0.05 (base) with Pollination Boost enabled (+20% on visit)
  • Seed Radius: 4–5
  • Max Local Density: 6–8
  • Max Age: 160, Maturity: 8–12 days
  • Use case: visually rich patches; strong synergy with birds/insects.

Shrub (slow but persistent)

  • Seed Chance: 0.02–0.03
  • Seed Radius: 5–7
  • Max Local Density: 5–6
  • Max Age: 220, Maturity: 12–18 days
  • Use case: anchors the scene; slower turnover.

Tuning loop

If herbivores starve: raise grass/flower Seed Chance or lower herbivore energy drain.
If predators starve: ensure pollinators linger long enough and interaction distances are reachable.


Performance notes

  • Plants are lightweight, but density checks scale with local overlap queries. Keep Max Local Density realistic and avoid excessive Seed Radius.
  • Prefer simple triggers over mesh colliders.
  • Large worlds: consider chunk-based loading for visuals; GrowthAgent itself is cheap but thousands of active instances still add up.

Troubleshooting

Plants never propagate
- Check Maturity and Max Age; immature plants won’t seed.
- Seed Chance too low or Max Local Density too tight.
- Height/slope filters may be excluding placements.
- Underwater areas are skipped—verify Water Level.

Pollinators don’t visit plants
- Interact Distance for flyers might be too small (try 2.0–3.0).
- Ensure plants have a trigger collider and, optionally, Tag = Plant.
- Pollinators must be hungry enough to forage/visit (check hunger threshold).

Plants disappear rapidly
- Herbivore pressure is too high → reduce herbivore count or energy drain, or increase plant density/seed chance.
- Max age too short; increase Max Age to keep anchors in the scene.

Patchy clumps or runaway carpets
- Use Max Local Density to cap clustering.
- Lower/raise Seed Chance and Seed Radius to reshape distribution.


See also

  • Terrain — height bands & water filters that affect placement
  • Fauna — roles (Herbivore vs. Pollinator) and interaction distances
  • Seeding (Editor) — ratios, spawn filters, underwater skip