---
title: willRemoveFromEntity()
framework: gameplaykit
role: symbol
role_heading: Instance Method
path: gameplaykit/gkcomponent/willremovefromentity()
---

# willRemoveFromEntity()

Notifies the component that it has been removed from an entity.

## Declaration

```swift
func willRemoveFromEntity()
```

## Discussion

Discussion Override this method in a component subclass if you need to perform game logic when the component is removed from to an entity. For example, if one component’s behavior depends on the presence of other components in the same entity, you can examine the entity’s components array in this method and take action accordingly.

## See Also

### Working with Entities

- [entity](gameplaykit/gkcomponent/entity.md)
- [didAddToEntity()](gameplaykit/gkcomponent/didaddtoentity().md)
