---
title: Use SpriteKit Objects within Scene Delegate Callbacks
framework: spritekit
role: article
role_heading: Article
path: spritekit/use-spritekit-objects-within-scene-delegate-callbacks
---

# Use SpriteKit Objects within Scene Delegate Callbacks

Follow threading guidelines to keep your SpriteKit app thread safe.

## Overview

Overview SpriteKit is largely a single threaded game engine and as such the API provides developers with callbacks to implement your custom game logic. The primary callback for your game logic is update(_:for:). Other callbacks are illustrated in SKSceneDelegate. Modifying SpriteKit objects outside of the scene delegate callbacks (such as in a background queue or anything else not running on the main thread) can result in concurrency related problems. Even dispatching work on the main thread asynchronously or at a later time is risky because the closure is likely to be done outside of the timeframe SpriteKit expects. If you’re experiencing a segmentation fault or other type of crash occurring deep within the SpriteKit framework, there’s a good chance your code is modifying a SpriteKit object outside of the scene delegate callbacks. note: To check at runtime if a particular block of code is running on the main thread, inspect isMainThread.

## See Also

### Handling Animation Events

- [update(_:for:)](spritekit/skscenedelegate/update(_:for:).md)
- [didEvaluateActions(for:)](spritekit/skscenedelegate/didevaluateactions(for:).md)
- [didSimulatePhysics(for:)](spritekit/skscenedelegate/didsimulatephysics(for:).md)
- [didApplyConstraints(for:)](spritekit/skscenedelegate/didapplyconstraints(for:).md)
- [didFinishUpdate(for:)](spritekit/skscenedelegate/didfinishupdate(for:).md)
