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


@interface GKEntity : NSObject


A 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 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 in GameplayKit Programming Guide.


Creating an Entity

- init

Initializes a new entity object.

+ entity

Creates a new entity object.

Managing an Entity’s List of Components


The entity’s list of components.

- componentForClass:

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

- addComponent:

Adds a component to the entity.

- removeComponentForClass:

Removes the component of the specified class from the entity.

Performing Periodic Updates

- updateWithDeltaTime:

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


Inherits From

See Also

Entities and Components


The abstract superclass for creating objects that add specific gameplay functionality to an entity.


Manages periodic update messages for all component objects of a specified class.