Instance Container
A serialized collection of instances that do not require individual GameObjects.
A component designed to manage large batches of instanced meshes (e.g., foliage, debris) without the overhead of individual GameObjects. It serializes transform data, integrates with the central FloraSystem, and exposes a simple API for adding, updating, querying, and removing instances at runtime or in the editor. See also: Conversion

Properties
Prefab
The prefab used for all instances. Changing this will re-create instances in the container.
InstanceHandles
Runtime handles for each instance.
LocalTransforms
Runtime container-space transforms for each instance.
Example
public class FoliageSpawner : MonoBehaviour
{
public FloraInstanceContainer container;
public GameObject treePrefab;
void Start()
{
container.Prefab = treePrefab;
// Spawn 100 instances in a grid
for (int x = 0; x < 10; x++)
for (int z = 0; z < 10; z++)
{
var pos = new Vector3(x * 2f, 0, z * 2f);
container.AddInstance(pos, Quaternion.identity, Vector3.one, Space.World);
}
}
}
Last updated