Floralin
DocsLive plants

Live plants

A live plant is a GameObject with a Floralin Plant component. It grows its mesh from a specimen library when it is enabled, in the editor and in your game.

Place one

  • Drag a .flores file from the pack's Specimens/ folder into a scene, or
  • drag a picture from the Plant Browser, or
  • add Floralin › Floralin Plant to any GameObject and assign its Specimens field.

The inspector

Specimens
The specimen library: one .flores file per species.
Form
The species itself or one of its forms (buds, seedheads, snow…).
Specimen
Which individual, by number: 64 per species and form.
Palette
The species' own colours, one of its named palettes, or Custom: your own colours for this plant, edited by name. See Colours.
LOD Group
On (the default): three detail levels, as the prefabs have, with switch points you may edit. Off: one mesh at the Detail you choose. See Level of detail.
Collision, Foliage collision
The collider level and how foliage collides. See Colliders.
Bake to prefab
Keeps the plant as an ordinary prefab. See Baking.
Browse plants
Opens the Plant Browser at this plant's form.

Select several live plants to change them together. A field whose values differ shows a dash and stays as it is until you pick something. The palette can be changed together only on plants of one form.

A changed plant regrows at once. Its meshes and colliders are not saved in the scene: the scene keeps the settings, and the plant grows again when the scene opens.

From a script

Every inspector field is a property on Floralin.Plants.FloralinPlant: Specimens, Entry (the form), Specimen, Palette, CustomColours, LodGroup, Detail, Collision and FoliageCollision. Setting one regrows the plant.

using Floralin.Plants;
using UnityEngine;

public class Meadow : MonoBehaviour
{
    public FloralinSpecimens library;   // a .flores file

    void Start()
    {
        var plant = new GameObject("Poppy").AddComponent<FloralinPlant>();
        plant.Specimens = library;
        plant.Specimen = Random.Range(0, 64);   // a different plant each time
    }
}

Cost

  • Time: a plant grows on the main thread when it is enabled. Growing its three LODs takes under 3 ms for every Wildflowers form, and under 1 ms for most (engine time on an Apple M3 Pro); Unity's own mesh upload comes on top. Grow plants while a scene loads, not every frame.
  • Memory: plants with the same settings share one mesh and one material, so a meadow of many copies of a few specimens costs little. Thousands of different specimens each keep their own mesh: for large areas, use a few specimens many times, or bake them.
  • Drawing: GPU instancing is on in every material, so copies draw together.
  • Colliders: Simple and Compound colliders are read from the specimen library, not fitted; Detailed colliders are fitted when first asked for and take noticeably longer.

Slow forms

A few forms take far longer to grow than the rest: merged bodies such as mossy stones and ground patches. The pack knows which, measured when it was made:

  • The inspector shows a warning on a slower form and an error on a slow one, and the Plant Browser labels a slow form (slow).
  • Tools › Floralin › Find Slow Live Plants lists the live plants of slow forms in the open scenes, in the Console, with a link to each.
  • Each pack page gives its plants' cost and marks such forms bake recommended.

For those, use the pack's ready prefab of the form, or Bake to prefab: a prefab costs nothing to grow.