Animals (Fauna)¶
Animals are driven by the AnimalAgent component. Each agent has a role (Herbivore, Predator, Pollinator, Neutral), locomotion (Ground, Air, Slither), basic energetics (hunger, drain, replenishment), perception (sense radius), interaction distance (eat/visit/strike range), and reproduction with guard rails (intervals, energy/age checks, local density).
This page explains prefab setup, fields, role behaviors, balancing notes, and troubleshooting.
In this article¶
- Prerequisites
- Quick start
- Prepare an animal prefab
- AnimalAgent fields
- Roles & behaviors
- Perception & interaction
- Energy & hunger
- Reproduction
- Movement & locomotion
- Balancing examples
- Performance notes
- Troubleshooting
Prerequisites¶
- At least one plant species in the scene (herbivores/pollinators need them).
- Terrain generated with a Water Level (spawning can skip underwater zones).
Tip
You do not need to set tags by hand. Role markers (e.g., PollinatorEmitter, HerbivoreEmitter) are auto-managed by AnimalAgent based on the chosen role.
Quick start¶
- Create an empty GameObject.
- Add
AnimalAgent. - Parent your model under it and reset local transform (0,0,0 / 1,1,1).
- Pick Role (Herbivore / Predator / Pollinator / Neutral) and Locomotion (Ground / Air / Slither).
- Tune sense radius, interaction distance, energy settings, and birth interval.
- Drag to Project to create a prefab.
- In the Fauna tab, add the prefab and spawn a few agents.

Prepare an animal prefab¶
Hierarchy Animal_Root (with AnimalAgent + simple collider) └── Model (mesh, materials, animator, VFX as needed) - Collider: a simple trigger on the root is enough for proximity checks. - Scale/Pivots: Keep root scale 1,1,1; pivot near feet (Y≈0) for clean ground alignment. - Offspring parenting: newborns are auto-parented under a scene object named Fauna (created if missing).
AnimalAgent fields¶
Identification & role¶
| Field | What it does | Notes |
|---|---|---|
| Role | Chooses behavior set | Herbivore / Predator / Pollinator / Neutral |
| Diet Target (Predator only) | Which roles count as prey | Typically Herbivore or Pollinator |
| Locomotion | Movement style | Ground / Air / Slither (snakes) |
Perception & interaction¶
| Field | What it does | Typical range | Notes |
|---|---|---|---|
| Sense Radius | How far to scan for food/prey/plants | 20–80 | Larger costs more CPU |
| Interact Distance | Eat / Visit / Strike range | 1.3–3.0 | Flyers benefit from 2.0–3.0 |
Energetics¶
| Field | What it does | Typical range | Notes |
|---|---|---|---|
| Energy Drain / sec | Idle consumption | 0.15–0.40 | Higher forces active foraging |
| Hungry Threshold | Energy fraction that triggers foraging | 0.7–0.95 | Higher makes agents forage earlier |
| Eat / Visit Gain | Energy gained from plant or visit | 15–40 | Pollinators gain on visit (non-destructive) |
| Strike Gain | Energy gained from a successful attack | 25–60 | Predators only |
| Post-Interact Linger (s) | Wait time after eat/visit/strike | ~30s | Flyers are grounded during linger |
Reproduction¶
| Field | What it does | Typical range | Notes |
|---|---|---|---|
| Birth Interval (s) | Time between birth attempts | 20–40 | Longer = slower population growth |
| Maturity (days) | Minimum age to reproduce | 2–10 | Prevents instant bursts |
| Local Density Cap | Max neighbors before cancelling | 4–8 | Stabilizes hotspots |
Starvation & death
If energy hits 0, the agent dies. This is the primary safety valve to prevent runaway populations.
Roles & behaviors¶
Herbivore¶
- Goal: find nearby plants, consume (destructive), gain energy, linger briefly.
- Notes: If plants are scarce, they roam; adjust seeding or reduce energy drain.
Pollinator¶
- Goal: find nearby plants, visit (non-destructive), gain energy, then linger on ground.
- Effect: plant receives a temporary pollination boost (e.g., higher seeding chance).
- Predator window: lingering creates an opportunity for predators (e.g., snakes).
Predator¶
- Goal: seek prey (usually Herbivores or Pollinators) and strike when in range, gain energy, linger.
- Balancing: ensure prey exist and are occasionally grounded/lingering long enough.
Neutral¶
- Goal: ambience—simple wandering without foraging or striking.
Perception & interaction¶
- Agents scan for targets using Sense Radius.
- Interactions succeed when within Interact Distance.
- Flying agents (Air): reaching a plant can be evaluated via horizontal proximity, then they linger on ground after visiting.
Tip
If birds hover above plants but never “reach” them, raise Interact Distance to 2.0–3.0 and ensure plants have a small trigger collider.
Energy & hunger¶
- Agents continuously lose energy (Energy Drain / sec).
- When under Hungry Threshold, they prioritize foraging/visiting/striking.
- Eat/Visit/Strike Gain restores energy; without it, agents eventually starve.
Note
Pollinators do not eat plants; they visit and still gain energy. Herbivores remove the plant object when eating.
Reproduction¶
- Every Birth Interval, an agent checks:
- Age ≥ Maturity
- Energy above a safe margin
- Local density below cap
- (Optionally) Nearby predator not too close
- If conditions hold, a single offspring is spawned near the parent and parented under Fauna.
Taming population
Slow down growth by increasing Birth Interval, decreasing Eat/Visit/Strike Gain, or increasing Energy Drain / sec.
Movement & locomotion¶
- Ground: simple planar movement with obstacle avoidance.
- Air: roams at altitude; grounds during linger for predator readability.
- Slither: lower speed, tighter turns; good for snakes hunting grounded targets.
Wander Radius and base speed (if exposed in your build) shape how far/fast animals patrol.
Balancing examples¶
Deer (Herbivore)¶
- Locomotion: Ground
- Sense Radius: 40–60
- Interact Distance: 1.8
- Energy Drain: 0.22
- Eat Gain: 30
- Linger: 8–12s
- Birth Interval: 32s, Local Density Cap: 6
Notes: Needs steady grass/flowers. If starving, raise plant seeding or lower drain.
Bird (Pollinator)¶
- Locomotion: Air
- Sense Radius: 60–80
- Interact Distance: 2.5
- Energy Drain: 0.20
- Visit Gain: 22
- Linger: 30s (grounds the bird)
- Birth Interval: 36s, Local Density Cap: 6
Notes: Long linger creates a window for predators; ensure plants have trigger colliders.
Snake (Predator)¶
- Locomotion: Slither
- Sense Radius: 50–70
- Interact Distance: 1.6–2.0
- Energy Drain: 0.24
- Strike Gain: 35–45
- Linger: 10–14s
- Prey: Pollinators (birds)
- Birth Interval: 38s, Local Density Cap: 5
Notes: Works best when birds linger near ground after visiting plants.
Performance notes¶
- Sense Radius dominates CPU cost (overlap queries). Keep values reasonable; fewer high-radius predators is better than many.
- Camera HUD adds cost; reduce camera count if needed.
- Prefer simple colliders; avoid mesh colliders on agents.
Troubleshooting¶
“Birds never visit plants.”
- Raise Interact Distance to 2.0–3.0 for flyers.
- Ensure plants have a small trigger collider; optional tag=Plant.
- Check Hungry Threshold—if too low, birds stay “not hungry” for long.
“Snakes can’t catch birds.”
- Ensure birds linger long enough (≈30s).
- Increase snake Sense Radius and base speed slightly.
- Make sure lingering grounds flyers so they’re hittable.
“Deer population explodes.”
- Increase Energy Drain or Birth Interval; reduce Eat Gain.
- Reduce plant seed chance or local density caps.
“Everything dies out.”
- Increase plant seeding, reduce predator counts, or lower drains.
- Verify that underwater spawning is skipped; if most of the map is water, consider raising terrain.
See also¶
- Flora — GrowthAgent, seeding, pollination boost
- Seeding (Editor) — ratios, underwater/height filters
- HUD & Monitoring — camera grid and overlays