Instance Handle

A lightweight struct used to uniquely identify and reference individual instances.

Flora manages all instances in a single global, native container using a Structure of Arrays (SOA) layout. FloraInstanceHandle lets you reference individual instances without needing to know where they’re stored internally. You can use these handles to query instance data, modify their state, or track them over time.

Validity

A handle is considered valid if both its Index and Version match an active instance in the FloraSystem. When an instance is destroyed, its version is incremented—this makes any previously held handles to that index invalid.

Usage

Creating Instances

FloraInstanceHandle handle = FloraSystem.Instance.CreateInstance(prefab, parent, position, rotation, scale);

Destroying Instances

FloraSystem.Instance.DestroyInstance(handle);

Checking if an Instance Exists

bool exists = FloraSystem.Instance.InstanceExists(handle);

Enabling or Disabling an Instance

bool isEnabled = FloraSystem.Instance.GetInstanceEnabled(handle);
FloraSystem.Instance.SetInstanceEnabled(handle, true);

Getting Instance Transform or Bounds

float3 position = FloraSystem.Instance.GetInstancePosition(handle);
Bounds bounds = FloraSystem.Instance.GetInstanceBounds(handle);

Last updated