Performs periodic updates for each of the entity’s components.
- iOS 9.0+
- macOS 10.11+
- Mac Catalyst 13.0+
- tvOS 9.0+
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).
At runtime, an entity/component-based game needs to dispatch periodic logic—from an update/render loop method such as
update: (SpriteKit) or
renderer: (SceneKit), or a
CADisplay (iOS) or
CVDisplay (macOS) timer in a custom rendering engine—to each of its components, so that each can perform component-specific update logic.
update 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 method for each of its components.
The other option is to dispatch updates per-component, rather than per-entity, using a
GKComponent 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.