Creates a low-level instance data object with an instance count and capacity.
- Parameters:
- instanceCount: The number of instances this low-level instance data.
- instanceCapacity: The maximum number of instances this low-level instance data can hold.
Creates a low-level instance data object with an instance count.
This initializer also applies the instance count to ``instanceCapacity``.
- Parameter instanceCount: The number of instances in this instance data object.
get · iOS 26.0+
instanceCount
TypeScript
get instanceCount(): number
Swift declaration
final var instanceCount: Int { get set }
The current number of instances in this low-level instance data.
set · iOS 26.0+
instanceCount
TypeScript
set instanceCount(value: number)
Swift declaration
final var instanceCount: Int { get set }
The current number of instances in this low-level instance data.
final func withTransforms(_ callback: (UnsafeBufferPointer<float4x4>) -> Void)
Reads the per instance transform data synchronously on the CPU.
The transform buffer provided is only valid for the lifetime of the callback.
get · iOS 26.0+
instanceCapacity
TypeScript
get instanceCapacity(): number
Swift declaration
final var instanceCapacity: Int { get }
The maximum number of instances this low-level instance data
draws when set on a mesh instances component.
``instanceCount`` must be less than or equal to the `instanceCapacity`
determined on initialization.
final func replaceMutableTransforms(_ callback: (UnsafeMutableBufferPointer<float4x4>) -> Void)
Replaces the per instance transform data synchronously on the CPU.
The transform buffer's contents are unspecified, and it is the caller's responsibility
to populate the buffer with valid data.
The transform buffer provided is only valid for the lifetime of the callback.
method · iOS 26.0+
read
TypeScript
read(commandBuffer: SDKHandle): SDKHandle
Swift declaration
final func read(using commandBuffer: any MTLCommandBuffer) -> any MTLBuffer
Retrieves the current per instance transform data, for GPU reading.
method · iOS 26.0+
replace
TypeScript
replace(commandBuffer: SDKHandle): SDKHandle
Swift declaration
final func replace(using commandBuffer: any MTLCommandBuffer) -> any MTLBuffer
Retrieves a Metal buffer that you can use to replace the per instance transform data
on GPU using Metal.
The transform buffer's contents are in an uninitialized state.
The caller supplies the MTLCommandBuffer that they intend to use for transform buffer modifications. RealityKit will
wait for the MTLCommandBuffer to complete before utilizing the transform buffer for rendering.