randomSeed
TypeScriptget randomSeed(): (number) | nullSwift declarationvar randomSeed: UInt32? { get set }An optional fixed random seed for the simulation. When `nil`, a random seed is chosen each time the simulation is (re)initialized.
struct · iOS 27.0+ · SDK 27.1
struct ComputeGraphComponentA component that drives a compute graph–based particle simulation on an entity. Attach this component to any `Entity` to with a loaded `ComputeGraphResource` and execute it each frame using Metal compute pipelines. The system automatically creates and manages child entities for each graph output, each carrying its own `ModelComponent` and material. ```swift var component = ComputeGraphComponent(resource: resource) entity.components.set(component) ```
get randomSeed(): (number) | nullSwift declarationvar randomSeed: UInt32? { get set }An optional fixed random seed for the simulation. When `nil`, a random seed is chosen each time the simulation is (re)initialized.
set randomSeed(value: (number) | null)Swift declarationvar randomSeed: UInt32? { get set }An optional fixed random seed for the simulation. When `nil`, a random seed is chosen each time the simulation is (re)initialized.
setTextureAt(texture: (SDKHandle) | null, index: number): voidSwift declarationmutating func setTexture(_ texture: (any MTLTexture)?, at index: Int)Binds a Metal texture to a parameter at the given index. - Parameters: - texture: The `MTLTexture` to bind, or `nil` to unbind the current texture. - index: The index of the texture parameter in the texture table.
setTexturePort(texture: (SDKHandle) | null, port: _ComputeGraph_ComputeNodeGraph_Port_Address): booleanSwift declaration@discardableResult mutating func setTexture(_ texture: (any MTLTexture)?, port: ComputeNodeGraph.Port.Address) -> BoolBinds a Metal texture to a parameter identified by its port address. - Parameters: - texture: The `MTLTexture` to bind, or `nil` to unbind the current texture. - port: The port address identifying the texture parameter. - Returns: `true` if the port was found and the texture was set; `false` otherwise.
fastForwardStepCountStepDeltaTime(stepCount: number, stepDeltaTime: number): voidSwift declarationmutating func fastForward(stepCount: Int, stepDeltaTime: Float)Advances the particle simulation by multiple steps in a single operation. - Parameters: - stepCount: The number of simulation steps to execute. Each step represents one iteration of the simulation update cycle. Must be positive. - stepDeltaTime: The time interval (in seconds) to use for each simulation step. - Note: The simulation will be advanced by a total time of `stepCount * stepDeltaTime` seconds.
fastForward(): voidSwift declarationmutating func fastForward()Fast-forwards the simulation using the default prewarm behavior.
uniformHandle(name: string): (ComputeGraphComponent_UniformHandle) | nullSwift declarationfunc uniformHandle(named name: String) -> ComputeGraphComponent.UniformHandle?Returns a handle for the named uniform. - Parameter name: The name of the named uniform. - Returns: A ``UniformHandle``, or `nil` if no match is found.
get simulationRate(): _ComputeGraph_ComputeGraphSimulation_SimulationRateSwift declarationvar simulationRate: ComputeGraphSimulation.SimulationRate { get set }The rate at which the simulation updates. Defaults to ``SimulationRate/default`` if no custom rate has been set.
set simulationRate(value: _ComputeGraph_ComputeGraphSimulation_SimulationRate)Swift declarationvar simulationRate: ComputeGraphSimulation.SimulationRate { get set }The rate at which the simulation updates. Defaults to ``SimulationRate/default`` if no custom rate has been set.
findBufferIndex(port: _ComputeGraph_ComputeNodeGraph_Port_Address): (number) | nullSwift declarationfunc findBufferIndex(port: ComputeNodeGraph.Port.Address) -> Int?isOutputEnabled(outputID: number): booleanSwift declarationfunc isOutputEnabled(_ outputID: ComputeNodeGraph.NodeID) -> BoolReads the enabled state of an output identified by ID - Returns: the enabled state, or false if the output is unknown
replaceUniforms(data: ArrayBuffer): voidSwift declarationmutating func replaceUniforms(_ data: Data)Replaces the entire uniform buffer with the given data. You can query `pipelines.assembly.uniformBufferSize` for the required size. If too few bytes are provided, the remaining bytes retain their previous values. - Parameter data: Raw bytes to write into the uniform buffer.
firstBufferIndex(type: string): (number) | nullSwift declarationfunc firstBufferIndex(type: String) -> Int?setOutputEnabled(outputID: number, enabled: boolean): voidSwift declarationmutating func setOutputEnabled(_ outputID: ComputeNodeGraph.NodeID, enabled: Bool)Sets the enable state of an output identified by ID This will cause the output mesh to disappear, and output stages to stop executing. The simulation, however, will continue to execute. See ``pause()``, ``play()``, and ``RealityKit.Entity.isEnabled`` to control the simulation as a whole
play(): voidSwift declarationmutating func play()Resumes the simulation from a paused or stepped state.
step(): voidSwift declarationmutating func step()Advances the simulation by a single frame, then pauses.
pause(): voidSwift declarationmutating func pause()Pauses the simulation, freezing it at its current state.
spawnElementIn(element: _ComputeGraph_ElementSpawnParameters, system?: (number) | null): voidSwift declarationmutating func spawn(element: ElementSpawnParameters, in system: ComputeNodeGraph.NodeID? = nil)Spawns a new element in the particle simulation. This method queues an element to be spawned during the next simulation update. The spawning is deferred and batched for performance reasons. - Parameters: - element: The spawn parameters defining the properties of the element to create - system: The ID of the specific system to spawn the element in. When `nil`, all systems will be asked to spawn the same element. - Note: The actual spawning occurs during the simulation update cycle.
spawnElementsIn(elements: Array<_ComputeGraph_ElementSpawnParameters>, system?: (number) | null): voidSwift declarationmutating func spawn(elements: [ElementSpawnParameters], in system: ComputeNodeGraph.NodeID? = nil)Spawns elements into the particle simulation. This method queues an element to be spawned during the next simulation update. The spawning is deferred and batched for performance reasons. - Parameters: - element: The spawn parameters defining the properties of the element to create - system: The ID of the specific system to spawn the element in. When `nil`, all systems will be asked to spawn the same element. - Note: The actual spawning occurs during the simulation update cycle.
get state(): ComputeGraphComponent_SimulationStateSwift declarationvar state: ComputeGraphComponent.SimulationState { get set }The current playback state of the simulation.
set state(value: ComputeGraphComponent_SimulationState)Swift declarationvar state: ComputeGraphComponent.SimulationState { get set }The current playback state of the simulation.
get models(): Record<number, _RealityFoundation_ModelComponent>Swift declarationvar models: [ComputeNodeGraph.NodeID : ModelComponent] { get set }Per-output model component overrides, keyed by output node identifier. When non-`nil`, these model components replace those defined in ``resource``. Set to `[:]` to restore resource-defined models.
set models(value: Record<number, _RealityFoundation_ModelComponent>)Swift declarationvar models: [ComputeNodeGraph.NodeID : ModelComponent] { get set }Per-output model component overrides, keyed by output node identifier. When non-`nil`, these model components replace those defined in ``resource``. Set to `[:]` to restore resource-defined models.
get resource(): (ComputeGraphResource) | nullSwift declarationvar resource: ComputeGraphResource? { get set }The compute graph resource that defines the simulation. Assigning a new resource replaces the current graph and resets the simulation. Set to `nil` to detach the resource without destroying the entity.
set resource(value: (ComputeGraphResource) | null)Swift declarationvar resource: ComputeGraphResource? { get set }The compute graph resource that defines the simulation. Assigning a new resource replaces the current graph and resets the simulation. Set to `nil` to detach the resource without destroying the entity.
static initResource(resource: ComputeGraphResource): ComputeGraphComponentSwift declarationinit(resource: ComputeGraphResource)Creates a `ComputeGraphComponent` and immediately attaches the given resource. - Parameter resource: The ``ComputeGraphResource`` that defines the simulation.
get materials(): Record<number, SDKHandle>Swift declarationvar materials: [ComputeNodeGraph.NodeID : any Material] { get set }Per-output material overrides, keyed by output node identifier. When non-`nil`, these materials replace the corresponding materials defined in ``resource``. Set to `[:]` to restore resource-defined materials.
set materials(value: Record<number, Implements<_RealityFoundation_Material> | SDKHandle>)Swift declarationvar materials: [ComputeNodeGraph.NodeID : any Material] { get set }Per-output material overrides, keyed by output node identifier. When non-`nil`, these materials replace the corresponding materials defined in ``resource``. Set to `[:]` to restore resource-defined materials.
get pipelines(): (_ComputeGraph_ComputeNodeGraph_Pipelines) | nullSwift declarationvar pipelines: ComputeNodeGraph.Pipelines? { get set }The compiled pipelines used to execute the simulation. When `nil`, the pipelines from ``resource`` are used. Assigning a value overrides the resource's pipelines without replacing the loaded assets.
set pipelines(value: (_ComputeGraph_ComputeNodeGraph_Pipelines) | null)Swift declarationvar pipelines: ComputeNodeGraph.Pipelines? { get set }The compiled pipelines used to execute the simulation. When `nil`, the pipelines from ``resource`` are used. Assigning a value overrides the resource's pipelines without replacing the loaded assets.
setBuffer(buffer: (SDKHandle) | null, bufferOffset: number, elementCount: (number) | null, index: number): voidSwift declarationmutating func setBuffer(_ buffer: (any MTLBuffer)?, bufferOffset: Int = 0, elementCount: Int? = nil, at index: Int)Binds a Metal buffer to a parameter. - Parameters: - buffer: The `MTLBuffer` to bind. - bufferOffset: Byte offset into `buffer`. Defaults to `0`. - elementCount: Number of elements in the buffer, for buffers with variable capacity. - at: Index into the device buffers table.
static init(): ComputeGraphComponentSwift declarationinit()Creates a `ComputeGraphComponent` with no resource attached.
3 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.
ComputeGraphComponent.setUniformData(_:for:)
The iOS SDK compiler rejected this binding: instance method 'arg' requires that 'RawSpan' conform to 'Escapable'
ComputeGraphComponent.setUniformValue(_:for:)
This declaration needs Swift generic type arguments. (no canonical witness for V)
ComputeGraphComponent.setUniformValue(_:named:)
This declaration needs Swift generic type arguments. (no canonical witness for V)