System
The global system that stores and manages all Flora instances.
FloraSystem is the global runtime API for creating, updating, querying, and destroying Flora instances.
Access
Use FloraSystem.GetOrCreate() to get the active system or create one.
FloraSystem flora = FloraSystem.GetOrCreate();Create and destroy instances
FloraInstanceHandle handle = flora.CreateInstance(prefab, parent, position, rotation, scale);
flora.DestroyInstance(handle);
flora.CreateInstances(prefab, parent, handles, transforms);
flora.DestroyInstances(handles);Instance relationships
Flora tracks three distinct GameObject roles for each instance. The same object can fill more than one role.
Prefab
Prefab
Which prefab does the instance represent? Scene-only renderers have no prefab.
Render Definition
RenderDefinition
Which object does Flora read for the renderer hierarchy, meshes, materials, and LODs?
Owner
Owner
Which scene object manages the instance's placement, lifetime, or grouping?
Common registration paths map these roles as follows:
CreateInstance(prefab, owner, ...)
Prefab
Prefab
Supplied owner
Prefab-backed FloraInstanceRenderer
Prefab asset
Scene instance
Scene instance
Scene-only FloraInstanceRenderer
None
Scene object
Scene object
Terrain tree
Tree prefab
Tree prefab
Terrain
Choose filters by the relationship you want to match:
FloraInstanceFilter.ByPrefab(prefab)matches every instance representing that prefab, regardless of its owner or render definition.FloraInstanceFilter.ByOwner(owner)matches every instance managed by that terrain, container, renderer host, or other scene owner.FloraInstanceFilter.ByRenderDefinition(renderDefinition)matches the exact object supplying render data. This is mainly useful for advanced scene-renderer and diagnostic workflows.
Use GetInstancePrefab(...), GetInstanceRenderDefinition(...), and GetInstanceOwnerGameObject(...) to inspect these relationships for an instance handle. GetInstancePrefab(...) returns null for scene-only renderers.
Enable and disable instances
Queries
Choose the query family by what must be inside the search area:
FindInstancesIntersecting...
Render bounds
FindInstanceOriginsWithin...
Transform origin
Both families support:
unfiltered queries
FloraInstanceFilterqueries, such asByTrees()andByLayerMask(...)prefab queries using
NativeArray<EntityId>allocated results or a reusable
NativeList<FloraInstanceHandle>
Terrain details are transient GPU data and are excluded from instance-handle queries. FloraInstanceFilter.ByDetails() and FloraInstanceTypeMask.TerrainDetail are obsolete and never match. Use the dedicated terrain-detail query API to test a specific prototype near a position without creating CPU detail instances.
Runtime-created instance layers
CreateInstance(...) and CreateInstances(...) accept a FloraPrefabLayerSource:
Owner uses the owner or parent layer and is the default. Prefab uses the prefab layer.
Variation color
Enable VariationColor in FloraAdditionalRendererSettings.AdditionalPerInstanceData, then submit colors through Flora:
Keep readable colors in caller-owned data. GetInstanceVariationColor(...) is obsolete, always throws NotSupportedException, and will be removed in 7.0.
Migration Note
InSphere and InBounds were replaced by FindInstancesIntersecting.... See Upgrade from 6.3.35 for other compatibility changes.
Last updated