removeFromParent(preservingWorldTransform:)
Removes the entity from its current parent or from the scene if it is a root entity.
Declaration
@MainActor @preconcurrency func removeFromParent(preservingWorldTransform: Bool = false)Parameters
- preservingWorldTransform:
A Boolean that you set to
trueto preserve the entity’s world transform, orfalseto preserve its relative transform. Usetruewhen you want a model to keep its effective location and size within a scene.
Discussion
This method behaves like the setParent(_:preservingWorldTransform:) method with a value of nil for the parent parameter, except that method has no effect on root entities. A root entity is one that is stored in a scene’s anchors collection.
The children collections of any modified parent entities are automatically updated as well.