<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/Entity/ChildCollection/replaceAll(_:preservingWorldTransforms:)-1vwk4",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:17RealityFoundation6EntityC15ChildCollectionV10replaceAll_25preservingWorldTransformsyx_SbtSTRzAC7ElementRczlF"
  },
  "title" : "replaceAll(_:preservingWorldTransforms:)"
}
-->

# replaceAll(_:preservingWorldTransforms:)

Removes all children from this entity and adds the specified list of entities as the new
children.

```
@MainActor @preconcurrency func replaceAll<S>(_ children: S, preservingWorldTransforms: Bool = false) where S : Sequence, S.Element : Entity
```

## Parameters

`children`

The list of the new children.

`preservingWorldTransforms`

`true` to preserve the world transform. `false` to
preserve the relative transform. (Use `true` if the
entities should keep its effective location and size in
the scene!)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)