A container for associating GameplayKit objects with a SpriteKit scene.
- iOS 10.0+
- macOS 10.12+
- Mac Catalyst 13.0+
- tvOS 10.0+
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
init(file method. You can then use the
graphs properties to access the
GKEntity (and associated
GKComponent) objects and
GKGraph objects in the scene, and the
root property to access the scene’s SpriteKit content.