For the complete documentation index, see llms.txt. This page is also available as Markdown.

System

The global system that stores and manages all Flora instances.

The FloraSystem is the global runtime API for Flora instances.

What It Is

FloraSystem stores runtime instance data and provides methods to create, modify, query, and destroy instances.

When To Use It

Use FloraSystem when you need runtime control (spawning, simulation updates, queries, bulk enable/disable).

Access Pattern

Use FloraSystem.GetOrCreate() to guarantee an active system.

var flora = FloraSystem.GetOrCreate();

Core Tasks

Create or destroy a single instance

FloraInstanceHandle handle = FloraSystem.GetOrCreate()
    .CreateInstance(prefab, parent, pos, rot, scale);

FloraSystem.Instance?.DestroyInstance(handle);

Create or destroy a batch of instances

Control instance visibility

Query instances by sphere or bounds

FindInstancesIntersectingSphere* and FindInstancesIntersectingBounds* test each instance's render bounds. Use these when you need objects whose visible bounds overlap an area, such as impact volumes, damage zones, or visibility tools.

FindInstanceOriginsWithinSphere* and FindInstanceOriginsWithinBounds* test each instance's transform origin. Use these when the position itself must be inside the area, regardless of mesh bounds size.

Both query families support:

  • unfiltered queries

  • FloraInstanceFilter queries, such as ByTrees(), ByLayerMask(...), ByIdentitySource(...), and ByRenderSource(...)

  • prefab instance ID queries using NativeArray<int>

  • allocation-returning overloads with an Allocator

  • caller-owned NativeList<FloraInstanceHandle> overloads that clear and reuse the result list

Origin-query entry points are:

  • FindInstanceOriginsWithinSphere(...)

  • FindInstanceOriginsWithinSphereMatching(...)

  • FindInstanceOriginsWithinBounds(...)

  • FindInstanceOriginsWithinBoundsMatching(...)


Example

How To Verify

  • Created instances are visible and have valid handles.

  • Render-bounds queries return instances whose visible bounds overlap the search area.

  • Origin queries return instances whose transform position is inside the search area.

  • Destroy/disable calls remove visibility and invalidate stale handles.

Migration Note

Older InSphere and InBounds query names were replaced by the FindInstancesIntersecting... render-bounds query names.

Last updated