Contents

GKScene

A container for associating GameplayKit objects with a SpriteKit scene.

Declaration

class GKScene

Overview

When you create a scene in the Xcode SpriteKit scene editor, Xcode automatically creates a GKScene object to manage any GameplayKit objects you add to the scene (entities, components, or pathfinding graphs) and archive them alongside the SpriteKit scene content.

To use a SpriteKit scene that contains GameplayKit objects, load the scene file with the GKScene init(fileNamed:) method. You can then use the entities and graphs properties to access the GKEntity (and associated GKComponent) objects and GKGraph objects in the scene, and the rootNode property to access the scene’s SpriteKit content.

For more information on Entity-Component architecture and pathfinding graphs, see Entities and Components and Pathfinding in GameplayKit Programming Guide.

Topics

Loading a Scene File

Accessing the SpriteKit Scene

Managing Entities and Components

Managing Pathfinding Graphs

Initializers

Instance Methods

See Also

Xcode and SpriteKit Integration