Skip to content

SpriteKit Diagnostics

Systematic SpriteKit troubleshooting with decision trees and time-cost annotations. Covers the 7 most common SpriteKit symptoms that waste developer time.

Symptoms This Diagnoses

Use when you're experiencing:

  • didBegin(_:) never called (physics contacts not firing)
  • Objects passing through walls (tunneling)
  • Frame rate below 60fps (performance drops)
  • touchesBegan not called on nodes
  • Memory growing during gameplay
  • Sprites appearing in wrong positions (coordinate confusion)
  • Crashes during or after scene transitions

Example Prompts

  • "My physics contacts aren't firing, didBegin never gets called"
  • "Bullets pass through walls in my game"
  • "SpriteKit frame rate is dropping"
  • "touchesBegan doesn't work on my sprite node"
  • "Memory keeps growing during my game"
  • "My sprite positions are Y-flipped"
  • "App crashes when transitioning between scenes"

Diagnostic Workflow

Mandatory first step: Enable debug overlays (showsFPS, showsNodeCount, showsDrawCount, showsPhysics). Most SpriteKit bugs become visually obvious with overlays enabled.

Decision Trees

SymptomBranchesTime Saved
Physics contacts not firing6 branches30-120 min → 2-5 min
Objects tunneling through walls5 branches20-60 min → 5 min
Poor frame rate4 top, 12 leaves2-4 hrs → 15-30 min
Touches not registering6 branches15-45 min → 2 min
Memory spikes/crashes5 branches1-3 hrs → 15 min
Coordinate confusion5 branches20-60 min → 5 min
Scene transition crashes5 branches30-90 min → 5 min

Quick Reference

SymptomFirst CheckMost Likely Cause
Contacts don't firecontactDelegate set?Missing contactTestBitMask
TunnelingObject speed vs wall thicknessMissing usesPreciseCollisionDetection
Low FPSshowsDrawCountSKShapeNode in gameplay or missing atlas
Touches brokenisUserInteractionEnabled?Default is false on non-scene nodes
Memory growthshowsNodeCount increasing?Nodes created but never removed
Wrong positionsY-axis directionUsing view coordinates instead of scene
Transition crashwillMove(from:) cleanup?Strong references to old scene

Released under the MIT License