---
title: "update(deltaTime:)"
framework: gameplaykit
role: symbol
role_heading: Instance Method
path: "gameplaykit/gkentity/update(deltatime:)"
---

# update(deltaTime:)

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

## Declaration

```swift
func update(deltaTime seconds: TimeInterval)
```

## Parameters

- `seconds`: The time step to use for any time-dependent actions performed by this method (typically, the elapsed time since the previous call to this method).

## Discussion

Discussion At runtime, an entity/component-based game needs to dispatch periodic logic—from an update/render loop method such as update(_:) (SpriteKit) or renderer(_:updateAtTime:) (SceneKit), or a CADisplayLink (iOS) or CVDisplayLink (macOS) timer in a custom rendering engine—to each of its components, so that each can perform component-specific update logic. The GKEntity update(deltaTime:) method is one of the two options GameplayKit provides for dispatching updates—this option is easy to implement in games with small numbers of entities and components. Call this method for each entity in your game, and each entity will in turn call the update(deltaTime:) method for each of its components. The other option is to dispatch updates per-component, rather than per-entity, using a GKComponentSystem object. Using a component system allows you to update all components of a specific component class in a deterministic order, without needing to traverse your game’s object graph and update each entity. note: If a component owned by an entity is a member of a component system, calling the entity’s update(deltaTime:) method will not update that component.
