<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "GameplayKit",
  "identifier" : "/documentation/GameplayKit/GKEntity",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "GameplayKit"
    ],
    "preciseIdentifier" : "c:objc(cs)GKEntity"
  },
  "title" : "GKEntity"
}
-->

# GKEntity

An object relevant to gameplay, with functionality entirely provided by a collection of component objects.

```
class GKEntity
```

## Overview

A [`GKEntity`](/documentation/GameplayKit/GKEntity) object represents an entity in games with Entity-Component architecture. In this design, an *entity* is a general type for objects relevant to the game. Entities typically define no functionality of their own—instead, you define an entity’s features through composition, by adding *components* that each handle specific aspects of an entity’s behavior in a general way. Because components ([`GKComponent`](/documentation/GameplayKit/GKComponent) subclasses) are general and reusable, you can add many kinds of entities to a game by combining components in different ways, without needing to design new entity classes.

For more information on Entity-Component architecture, read [Entities and Components](https://developer.apple.com/library/archive/documentation/General/Conceptual/GameplayKit_Guide/EntityComponent.html#//apple_ref/doc/uid/TP40015172-CH6) in [GameplayKit Programming Guide](https://developer.apple.com/library/archive/documentation/General/Conceptual/GameplayKit_Guide/index.html#//apple_ref/doc/uid/TP40015172).

## Topics

### Creating an Entity

[`-  init`](/documentation/GameplayKit/GKEntity/init())

Initializes a new entity object.

[`+  entity`](/documentation/GameplayKit/GKEntity/entity)

Creates a new entity object.

### Managing an Entity’s List of Components

[`components`](/documentation/GameplayKit/GKEntity/components)

The entity’s list of components.

[`-  componentForClass:`](/documentation/GameplayKit/GKEntity/componentForClass:)

Returns the entity’s component for the specified component class.

[`-  addComponent:`](/documentation/GameplayKit/GKEntity/addComponent(_:))

Adds a component to the entity.

[`-  removeComponentForClass:`](/documentation/GameplayKit/GKEntity/removeComponentForClass:)

Removes the component of the specified class from the entity.

### Performing Periodic Updates

[`-  updateWithDeltaTime:`](/documentation/GameplayKit/GKEntity/update(deltaTime:))

Performs periodic updates for each of the entity’s components.

### Instance Methods

[`component(ofType:)`](/documentation/GameplayKit/GKEntity/component(ofType:))

[`removeComponent(ofType:)`](/documentation/GameplayKit/GKEntity/removeComponent(ofType:))

## Relationships

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

### Conforms To

[`NSCoding`](/documentation/Foundation/NSCoding)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`NSSecureCoding`](/documentation/Foundation/NSSecureCoding)

[`CVarArg`](/documentation/Swift/CVarArg)

[`Hashable`](/documentation/Swift/Hashable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`NSCopying`](/documentation/Foundation/NSCopying)

---

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)