---
title: "spawn(elements:in:)"
framework: realitykit
role: symbol
role_heading: Instance Method
platforms: [iOS 27.0+, iPadOS 27.0+, macOS 27.0+, tvOS 27.0+, visionOS 27.0+]
path: "realitykit/computegraphcomponent/spawn(elements:in:)"
---

# spawn(elements:in:)

Spawns elements into the particle simulation.

## Declaration

```swift
mutating func spawn(elements: [ElementSpawnParameters], in system: ComputeNodeGraph.NodeID? = nil)
```

## 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.

## Discussion

Discussion This method queues an element to be spawned during the next simulation update. The spawning is deferred and batched for performance reasons. note: The actual spawning occurs during the simulation update cycle.
