Prefab Preparation¶
Make flora and fauna plug-and-play. This page covers clean hierarchy layouts, colliders, scaling, animation hooks, LOD, and common pitfalls so your assets behave well with GrowthAgent and AnimalAgent.
In this article¶
- Prerequisites
- Folder & naming conventions
- Plant prefab (Flora)
- Animal prefab (Fauna)
- Scale, pivots, and colliders
- Animation & VFX (optional)
- LOD & optimization
- Variants & addressables (optional)
- QA checklist
- Troubleshooting
Prerequisites¶
- You’ve read Flora and Fauna to understand what the agents expect.
- Terrain & water level are configured (so you can quickly test spawns).
Tip
Treat prefabs like lego bricks: minimal assumptions, clean root, clear scale, simple colliders.
Plant prefab (Flora)¶
Goal: a lightweight root with GrowthAgent, a small trigger collider, and the model under it.
Hierarchy
Plant_Root (GrowthAgent + Trigger Collider + Tag=Plant [optional])
└── Model (mesh, materials, LODs if any)
Steps
1. Create Empty GameObject → rename to Plant_Root.
2. Add GrowthAgent to the root.
3. Add a Sphere Collider (check Is Trigger) with radius ~0.4–1.0.
4. (Optional) Set Tag = Plant (helps any tag-based fallbacks).
5. Make the mesh child of the root (reset local transform to 0/0/0; scale 1/1/1).
6. Tweak GrowthAgent fields (Max Age, Maturity, Seed Chance, etc.).
7. Drag the root to Project to create the prefab.

Visual scale vs. physics
GrowthAgent scales visuals over time. Keep the trigger collider constant and small; it’s only for proximity checks, not physical push.
Recommended defaults
- Start Scale: 0.2–0.4, Max Scale: 1.0–1.3
- Seed Chance: 0.03–0.06, Seed Radius: 3–5, Max Local Density: 6–8
Animal prefab (Fauna)¶
Goal: a clean root with AnimalAgent, a simple trigger collider, and your model/animator under it.
Hierarchy
Animal_Root (AnimalAgent + Trigger Collider)
└── Model (mesh, materials, Animator, SFX/VFX as needed)
Steps
1. Create Empty GameObject → Animal_Root.
2. Add AnimalAgent.
3. Add a Capsule/Sphere Collider (check Is Trigger). Keep it small and centered around the body.
4. Make your mesh (and Animator, if used) a child of Animal_Root.
5. In AnimalAgent:
- Role: Herbivore / Predator / Pollinator / Neutral
- Locomotion: Ground / Air / Slither
- Tune Sense Radius, Interact Distance, Energy Drain, Gains, Birth Interval
6. Drag Animal_Root to Project to create the prefab.
7. (Optional) Add SFX/VFX (footsteps, dust, strike impact) under Model.

Auto-parenting & markers
Newborn agents are parented under a Fauna object in the scene.
AnimalAgent auto-manages markers (PollinatorEmitter, HerbivoreEmitter) based on Role; you don’t need to add them manually.
Quick presets - Deer (Herbivore): Sense 40–60, Interact 1.8, Drain 0.22, Eat Gain 30, Linger 10s, Birth 32s. - Bird (Pollinator): Sense 60–80, Interact 2.5, Drain 0.20, Visit Gain 22, Linger 30s, Birth 36s. - Snake (Predator): Sense 50–70, Interact 1.6–2.0, Drain 0.24, Strike Gain 35–45, Linger 12s.
Scale, pivots, and colliders¶
| Aspect | Recommendation | Why |
|---|---|---|
| Root scale | 1,1,1 | Agents assume unit scale for movement math |
| Pivot (Y) | At feet / ground contact | Prevents floating/sinking on terrain |
| Collider | One small trigger on root | Cheap overlap checks for proximity |
| Mesh colliders | Avoid | Heavy & unnecessary for AI |
| Layers/Tags | Optional tag=Plant for flora |
Helps simple tag-based fallbacks |
Tip
Flyers (Air) often miss plants if Interact Distance is too small. Use 2.0–3.0 and keep plant triggers present.
Animation & VFX (optional)¶
You can wire animations with standard Animator states. AnimalAgent doesn’t require a specific controller, but you can drive parameters or use Animation Events:
- Common states:
Idle,Move,Eat/Visit,Strike,Die - Parameters:
speed(float),isMoving(bool),isGrounded(bool),role(int) - Animation Events: call public methods on
AnimalAgent/GrowthAgentat keyframes (e.g., bite/impact moments)
VFX ideas - Herbivore eat: small grass puff. - Pollinator visit: gentle sparkles on flowers. - Predator strike: quick trail/impact.
Tip
Keep animation clips short & loopable. Linger uses a timed wait; you can play a grounded idle during that period.
LOD & optimization¶
- Use Unity’s LODGroup on the Model child, not on the root.
- Keep tri counts modest; dozens of visible agents should stay within budget.
- Avoid per-frame heavy scripts on the model hierarchy.
- If you have many variants, prefer shared materials + different textures to maximize batching.
Sense radius costs - Overlap queries scale with radius; it’s the biggest CPU lever. - High-radius predators? Use fewer of them; compensate with better linger windows.
Variants & addressables (optional)¶
Prefab variants¶
- Create a base prefab
Bird_A, then Right Click → Create → Prefab Variant to getBird_B,Bird_C. - Change only mesh, textures, or small stats; keep agent settings consistent.
Addressables (if you stream content)¶
- Mark the prefab as Addressable.
- Pools/spawners can load by address (outside the scope of core docs).
QA checklist¶
- [ ] Root scale = 1,1,1, pivot makes sense (Y≈0).
- [ ] Trigger collider on root (Is Trigger = ✓).
- [ ] For plants:
GrowthAgenton root, optionaltag=Plant. - [ ] For animals:
AnimalAgenton root, Role and Locomotion set. - [ ] Interact Distance adequate (flyers 2.0–3.0).
- [ ] Visuals OK on uneven ground (no feet clipping or hovering).
- [ ] LODs work; material/shader variants don’t break batching.
- [ ] Offspring appear under Fauna parent at runtime.
Troubleshooting¶
Animals ignore plants
- Plant triggers missing, or Interact Distance too low.
- Flyers: raise to 2.0–3.0; ensure small trigger on plants.
Plants feel lifeless / don’t spread
- Seed Chance too low; or Max Local Density too strict.
- Check height/water filters; underwater spawn is skipped.
Predators starve
- Ensure pollinators linger long enough on ground (≈30s).
- Increase predator Sense Radius slightly or reduce their count.
Everything explodes in population
- Increase Energy Drain or Birth Interval for fauna; reduce Seed Chance for flora.
See also¶
- Flora — GrowthAgent, seeding, pollination boost
- Fauna — roles, energetics, reproduction
- Seeding (Editor) — ratios, spawn filters, underwater skip