[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6E6N5QRA626F0PHKQDMVCY8":3,"skill-same:01M6E6N5QRA626F0PHKQDMVCY8":123},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":27,"linkOnly":28,"markdownContent":29,"markdownBody":30,"frontMatter":31,"refName":34,"commitSha":35,"skillDirectory":36,"forksCount":37,"repositoryHtmlUrl":38,"repositoryHomepageUrl":39,"ownerHtmlUrl":40,"ownerBlogUrl":6,"ownerDescription":41,"updatedAt":42,"install":43,"resources":56},"01M6E6N5QRA626F0PHKQDMVCY8","axiom-spritekit-diag",null,"Use when physics contacts don't fire, objects tunnel through walls, frame rate drops, touches don't register, memory spikes, coordinate confusion, or scene transition crashes","ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FCharlesWiltgen\u002FAxiom\u002Faxiom-spritekit-diag\u002FSKILL.md",[],[19,20,21,22,23,24,25,26],"axiom spritekit diag","memory","use","coordinate","objects","physics","tunnel","register","2026-11-10 10:12:30",false,"---\nname: axiom-spritekit-diag\ndescription: Use when physics contacts don't fire, objects tunnel through walls, frame rate drops, touches don't register, memory spikes, coordinate confusion, or scene transition crashes\nlicense: MIT\nmetadata:\n  version: \"1.0.0\"\n---\n\n# SpriteKit Diagnostics\n\nSystematic diagnosis for common SpriteKit issues with time-cost annotations.\n\n## When to Use This Diagnostic Skill\n\nUse this skill when:\n- Physics contacts never fire (didBegin not called)\n- Objects pass through walls (tunneling)\n- Frame rate drops below 60fps\n- Touches don't register on nodes\n- Memory grows continuously during gameplay\n- Positions and coordinates seem wrong\n- App crashes during scene transitions\n\n## Mandatory First Step: Enable Debug Overlays\n\n**Time cost**: 10 seconds setup vs hours of blind debugging\n\n```swift\nif let view = self.view as? SKView {\n    view.showsFPS = true\n    view.showsNodeCount = true\n    view.showsDrawCount = true\n    view.showsPhysics = true\n}\n```\n\nIf `showsPhysics` doesn't show expected physics body outlines, your physics bodies aren't configured correctly. **Stop and fix bodies before debugging contacts.**\n\nFor SpriteKit architecture patterns and best practices, see `axiom-spritekit`. For API reference, see `axiom-spritekit-ref`.\n\n---\n\n## Symptom 1: Physics Contacts Not Firing\n\n**Time saved**: 30-120 min → 2-5 min\n\n```\ndidBegin(_:) never called\n│\n├─ Is physicsWorld.contactDelegate set?\n│   └─ NO → Set in didMove(to:):\n│        physicsWorld.contactDelegate = self\n│        ✓ This alone fixes ~30% of contact issues\n│\n├─ Does the class conform to SKPhysicsContactDelegate?\n│   └─ NO → Add conformance:\n│        class GameScene: SKScene, SKPhysicsContactDelegate\n│\n├─ Does body A have contactTestBitMask that includes body B's category?\n│   ├─ Print: \"A contact: \\(bodyA.contactTestBitMask), B cat: \\(bodyB.categoryBitMask)\"\n│   ├─ Result should be: (A.contactTestBitMask & B.categoryBitMask) != 0\n│   └─ FIX: Set contactTestBitMask to include the other body's category\n│        player.physicsBody?.contactTestBitMask = PhysicsCategory.enemy\n│\n├─ Is categoryBitMask set (not default 0xFFFFFFFF)?\n│   ├─ Default category means everything matches — but in unexpected ways\n│   └─ FIX: Always set explicit categoryBitMask for each body type\n│\n├─ Do the bodies actually overlap? (Check showsPhysics)\n│   ├─ Bodies too small or offset from sprite → Fix physics body size\n│   └─ Bodies never reach each other → Check collisionBitMask isn't blocking\n│\n└─ Are you modifying the world inside didBegin?\n    ├─ Removing nodes inside didBegin can cause missed callbacks\n    └─ FIX: Flag nodes for removal, process in update(_:)\n```\n\n### Quick Diagnostic Print\n\n```swift\nfunc didBegin(_ contact: SKPhysicsContact) {\n    print(\"CONTACT: \\(contact.bodyA.node?.name ?? \"nil\") (\\(contact.bodyA.categoryBitMask)) \u003C-> \\(contact.bodyB.node?.name ?? \"nil\") (\\(contact.bodyB.categoryBitMask))\")\n}\n```\n\nIf this never prints, the issue is delegate\u002Fbitmask setup. If it prints but with wrong bodies, the issue is bitmask values.\n\n---\n\n## Symptom 2: Objects Tunneling Through Walls\n\n**Time saved**: 20-60 min → 5 min\n\n```\nFast objects pass through thin walls\n│\n├─ Is the object moving faster than wall thickness per frame?\n│   ├─ At 60fps: max safe speed = wall_thickness × 60 pt\u002Fs\n│   ├─ A 10pt wall is safe up to ~600 pt\u002Fs\n│   └─ FIX: usesPreciseCollisionDetection = true on the fast object\n│\n├─ Is usesPreciseCollisionDetection enabled?\n│   ├─ Only needed on the MOVING object (not the wall)\n│   └─ FIX: fastObject.physicsBody?.usesPreciseCollisionDetection = true\n│\n├─ Is the wall an edge body?\n│   ├─ Edge bodies have zero area — tunneling is easier\n│   └─ FIX: Use volume body for walls (rectangleOf:) with isDynamic = false\n│\n├─ Is the wall thick enough?\n│   └─ FIX: Make walls at least 10pt thick for objects up to 600pt\u002Fs\n│\n└─ Are collision bitmasks correct?\n    ├─ Wall's categoryBitMask must be in object's collisionBitMask\n    └─ FIX: Verify with print: object.collisionBitMask & wall.categoryBitMask != 0\n```\n\n---\n\n## Symptom 3: Poor Frame Rate\n\n**Time saved**: 2-4 hours → 15-30 min\n\n```\nFPS below 60 (or 120 on ProMotion)\n│\n├─ Check showsNodeCount\n│   ├─ >1000 nodes → Offscreen nodes not removed\n│   │   ├─ Are you removing nodes that leave the screen?\n│   │   ├─ FIX: In update(), remove nodes outside visible area\n│   │   └─ FIX: Use object pooling for frequently spawned objects\n│   │\n│   ├─ 200-1000 nodes → Likely manageable, check draw count\n│   └─ \u003C200 nodes → Nodes aren't the problem, check below\n│\n├─ Check showsDrawCount\n│   ├─ >50 draw calls → Batching problem\n│   │   ├─ Using SKShapeNode for gameplay? → Replace with pre-rendered textures\n│   │   ├─ Sprites from different images? → Use texture atlas\n│   │   ├─ Sprites at different zPositions? → Consolidate layers\n│   │   └─ ignoresSiblingOrder = false? → Set to true\n│   │\n│   ├─ 10-50 draw calls → Acceptable for most games\n│   └─ \u003C10 draw calls → Drawing isn't the problem\n│\n├─ Physics expensive?\n│   ├─ Many texture-based physics bodies → Use circles\u002Frectangles\n│   ├─ usesPreciseCollisionDetection on too many bodies → Use only on fast objects\n│   ├─ Many contact callbacks firing → Reduce contactTestBitMask scope\n│   └─ Complex polygon bodies → Simplify to fewer vertices\n│\n├─ Particle overload?\n│   ├─ Multiple emitters active → Reduce particleBirthRate\n│   ├─ High particleLifetime → Reduce (fewer active particles)\n│   ├─ numParticlesToEmit = 0 (infinite) without cleanup → Add limits\n│   └─ FIX: Profile with Instruments → Time Profiler\n│\n├─ SKEffectNode without shouldRasterize?\n│   ├─ CIFilter re-renders every frame\n│   └─ FIX: effectNode.shouldRasterize = true (if content is static)\n│\n└─ Complex update() logic?\n    ├─ O(n²) collision checking? → Use physics engine instead\n    ├─ String-based enumerateChildNodes every frame? → Cache references\n    └─ Heavy computation in update? → Spread across frames or background\n```\n\n### Quick Performance Audit\n\n```swift\n#if DEBUG\nprivate var frameCount = 0\n#endif\n\noverride func update(_ currentTime: TimeInterval) {\n    #if DEBUG\n    frameCount += 1\n    if frameCount % 60 == 0 {\n        print(\"Nodes: \\(children.count)\")\n    }\n    #endif\n}\n```\n\n---\n\n## Symptom 4: Touches Not Registering\n\n**Time saved**: 15-45 min → 2 min\n\n```\ntouchesBegan not called on a node\n│\n├─ Is isUserInteractionEnabled = true on the node?\n│   ├─ SKScene: true by default\n│   ├─ All other SKNode subclasses: FALSE by default\n│   └─ FIX: node.isUserInteractionEnabled = true\n│\n├─ Is the node hidden or alpha = 0?\n│   ├─ Hidden nodes don't receive touches\n│   └─ FIX: Check node.isHidden and node.alpha\n│\n├─ Is another node on top intercepting touches?\n│   ├─ Higher zPosition nodes with isUserInteractionEnabled get first chance\n│   └─ DEBUG: Print nodes(at: touchLocation) to see what's there\n│\n├─ Is the touch in the correct coordinate space?\n│   ├─ Using touch.location(in: self.view)? → WRONG for SpriteKit\n│   └─ FIX: Use touch.location(in: self) for scene coordinates\n│        Or touch.location(in: targetNode) for node-local coordinates\n│\n├─ Is the physics body blocking touch pass-through?\n│   └─ Physics bodies don't affect touch handling — not the issue\n│\n└─ Is the node's frame correct?\n    ├─ SKNode (container) has zero frame — can't be hit-tested by area\n    ├─ SKSpriteNode frame matches texture size × scale\n    └─ FIX: Use contains(point) or nodes(at:) for manual hit testing\n```\n\n---\n\n## Symptom 5: Memory Spikes and Crashes\n\n**Time saved**: 1-3 hours → 15 min\n\n```\nMemory grows during gameplay\n│\n├─ Nodes accumulating? (Check showsNodeCount over time)\n│   ├─ Count increasing? → Nodes created but not removed\n│   │   ├─ Missing removeFromParent() for expired objects\n│   │   ├─ FIX: Add cleanup in update() or use SKAction.removeFromParent()\n│   │   └─ FIX: Implement object pooling for frequently spawned items\n│   │\n│   └─ Count stable? → Memory issue elsewhere\n│\n├─ Infinite particle emitters?\n│   ├─ numParticlesToEmit = 0 creates particles forever\n│   ├─ Each emitter accumulates particles up to birthRate × lifetime\n│   └─ FIX: Set finite numParticlesToEmit or manually stop and remove\n│\n├─ Texture caching?\n│   ├─ SKTexture(imageNamed:) caches — repeated calls don't leak\n│   ├─ SKTexture(cgImage:) from camera\u002Fdynamic sources → Not cached\n│   └─ FIX: Reuse texture references for dynamic textures\n│\n├─ Strong reference cycles in actions?\n│   ├─ SKAction.run { self.doSomething() } captures self strongly\n│   ├─ In repeatForever, this prevents scene deallocation\n│   └─ FIX: SKAction.run { [weak self] in self?.doSomething() }\n│\n├─ Scene not deallocating?\n│   ├─ Add deinit { print(\"Scene deallocated\") }\n│   ├─ If never prints → retain cycle\n│   ├─ Common: strong delegate, closure capture, NotificationCenter observer\n│   └─ FIX: Clean up in willMove(from:):\n│        removeAllActions()\n│        removeAllChildren()\n│        physicsWorld.contactDelegate = nil\n│\n└─ Instruments → Allocations\n    ├─ Filter by \"SK\" to see SpriteKit objects\n    ├─ Mark generation before\u002Fafter scene transition\n    └─ Persistent growth = leak\n```\n\n---\n\n## Symptom 6: Coordinate Confusion\n\n**Time saved**: 20-60 min → 5 min\n\n```\nPositions seem wrong or flipped\n│\n├─ Y-axis confusion?\n│   ├─ SpriteKit: origin at BOTTOM-LEFT, Y goes UP\n│   ├─ UIKit: origin at TOP-LEFT, Y goes DOWN\n│   └─ FIX: Use scene coordinate methods, not view coordinates\n│        touch.location(in: self)  ← CORRECT (scene space)\n│        touch.location(in: view)  ← WRONG (UIKit space, Y flipped)\n│\n├─ Anchor point confusion?\n│   ├─ Scene anchor (0,0) = bottom-left of view is scene origin\n│   ├─ Scene anchor (0.5,0.5) = center of view is scene origin\n│   ├─ Sprite anchor (0.5,0.5) = center of sprite is at position (default)\n│   ├─ Sprite anchor (0,0) = bottom-left of sprite is at position\n│   └─ FIX: Print anchorPoint values and draw expected position\n│\n├─ Parent coordinate space?\n│   ├─ node.position is relative to PARENT, not scene\n│   ├─ Child at (0,0) of parent at (100,100) is at scene (100,100)\n│   └─ FIX: Use convert(_:to:) and convert(_:from:) for cross-node coordinates\n│        let scenePos = node.convert(localPoint, to: scene)\n│        let localPos = node.convert(scenePoint, from: scene)\n│\n├─ Camera offset?\n│   ├─ Camera position offsets the visible area\n│   ├─ HUD attached to camera stays in place\n│   └─ FIX: For world coordinates, account for camera position\n│        scene.convertPoint(fromView: viewPoint)\n│\n└─ Scale mode cropping?\n    ├─ aspectFill crops edges — content at edges may be offscreen\n    └─ FIX: Keep important content in the \"safe area\" center\n```\n\n---\n\n## Symptom 7: Scene Transition Crashes\n\n**Time saved**: 30-90 min → 5 min\n\n```\nCrash during or after scene transition\n│\n├─ EXC_BAD_ACCESS after transition?\n│   ├─ Old scene deallocated while something still references it\n│   ├─ Common: Timer, NotificationCenter, delegate still referencing old scene\n│   └─ FIX: Clean up in willMove(from:):\n│        removeAllActions()\n│        removeAllChildren()\n│        physicsWorld.contactDelegate = nil\n│        \u002F\u002F Remove any NotificationCenter observers\n│\n├─ Crash in didMove(to:) of new scene?\n│   ├─ Accessing view before it's available\n│   ├─ Force-unwrapping optional that's nil during init\n│   └─ FIX: Use guard let view = self.view in didMove(to:)\n│\n├─ Memory spike during transition?\n│   ├─ Both scenes exist simultaneously during transition animation\n│   ├─ For large scenes, this doubles memory usage\n│   └─ FIX: Preload textures, reduce scene size, or use .fade transition\n│        (fade briefly shows neither scene, reducing peak memory)\n│\n├─ Nodes from old scene appearing in new scene?\n│   ├─ node.move(toParent:) during transition\n│   └─ FIX: Don't move nodes between scenes — recreate in new scene\n│\n└─ didMove(to:) called twice?\n    ├─ Presenting scene multiple times (button double-tap)\n    └─ FIX: Disable transition trigger after first tap\n         guard view?.scene !== nextScene else { return }\n```\n\n---\n\n## Common Mistakes\n\nThese mistakes cause the majority of SpriteKit issues. Check these first before diving into symptom trees.\n\n1. **Leaving default bitmasks** — `collisionBitMask` defaults to `0xFFFFFFFF` (collides with everything). Always set all three masks explicitly.\n2. **Forgetting `contactTestBitMask`** — Defaults to `0x00000000`. Contacts never fire without setting this.\n3. **Forgetting `physicsWorld.contactDelegate = self`** — Fixes ~30% of contact issues on its own.\n4. **Using SKShapeNode for gameplay** — Each instance = 1 draw call. Pre-render to texture with `view.texture(from:)`.\n5. **SKAction.move on physics bodies** — Actions override physics, causing jitter and missed collisions. Use forces\u002Fimpulses.\n6. **Strong self in action closures** — `SKAction.run { self.foo() }` in `repeatForever` creates retain cycles. Use `[weak self]`.\n7. **Not removing offscreen nodes** — Node count climbs silently, degrading performance.\n8. **Missing `isUserInteractionEnabled = true`** — Default is `false` on all non-scene nodes.\n\n---\n\n## Diagnostic Quick Reference Card\n\n| Symptom | First Check | Most Likely Cause |\n|---------|------------|-------------------|\n| Contacts don't fire | `contactDelegate` set? | Missing `contactTestBitMask` |\n| Tunneling | Object speed vs wall thickness | Missing `usesPreciseCollisionDetection` |\n| Low FPS | `showsDrawCount` | SKShapeNode in gameplay or missing atlas |\n| Touches broken | `isUserInteractionEnabled`? | Default is `false` on non-scene nodes |\n| Memory growth | `showsNodeCount` increasing? | Nodes created but never removed |\n| Wrong positions | Y-axis direction | Using view coordinates instead of scene |\n| Transition crash | `willMove(from:)` cleanup? | Strong references to old scene |\n\n## Resources\n\n**WWDC**: 2014-608, 2016-610, 2017-609\n\n**Docs**: \u002Fspritekit\u002Fskphysicsbody, \u002Fspritekit\u002Fmaximizing-node-drawing-performance\n\n**Skills**: axiom-spritekit, axiom-spritekit-ref\n\n","# SpriteKit Diagnostics\n\nSystematic diagnosis for common SpriteKit issues with time-cost annotations.\n\n## When to Use This Diagnostic Skill\n\nUse this skill when:\n- Physics contacts never fire (didBegin not called)\n- Objects pass through walls (tunneling)\n- Frame rate drops below 60fps\n- Touches don't register on nodes\n- Memory grows continuously during gameplay\n- Positions and coordinates seem wrong\n- App crashes during scene transitions\n\n## Mandatory First Step: Enable Debug Overlays\n\n**Time cost**: 10 seconds setup vs hours of blind debugging\n\n```swift\nif let view = self.view as? SKView {\n    view.showsFPS = true\n    view.showsNodeCount = true\n    view.showsDrawCount = true\n    view.showsPhysics = true\n}\n```\n\nIf `showsPhysics` doesn't show expected physics body outlines, your physics bodies aren't configured correctly. **Stop and fix bodies before debugging contacts.**\n\nFor SpriteKit architecture patterns and best practices, see `axiom-spritekit`. For API reference, see `axiom-spritekit-ref`.\n\n---\n\n## Symptom 1: Physics Contacts Not Firing\n\n**Time saved**: 30-120 min → 2-5 min\n\n```\ndidBegin(_:) never called\n│\n├─ Is physicsWorld.contactDelegate set?\n│   └─ NO → Set in didMove(to:):\n│        physicsWorld.contactDelegate = self\n│        ✓ This alone fixes ~30% of contact issues\n│\n├─ Does the class conform to SKPhysicsContactDelegate?\n│   └─ NO → Add conformance:\n│        class GameScene: SKScene, SKPhysicsContactDelegate\n│\n├─ Does body A have contactTestBitMask that includes body B's category?\n│   ├─ Print: \"A contact: \\(bodyA.contactTestBitMask), B cat: \\(bodyB.categoryBitMask)\"\n│   ├─ Result should be: (A.contactTestBitMask & B.categoryBitMask) != 0\n│   └─ FIX: Set contactTestBitMask to include the other body's category\n│        player.physicsBody?.contactTestBitMask = PhysicsCategory.enemy\n│\n├─ Is categoryBitMask set (not default 0xFFFFFFFF)?\n│   ├─ Default category means everything matches — but in unexpected ways\n│   └─ FIX: Always set explicit categoryBitMask for each body type\n│\n├─ Do the bodies actually overlap? (Check showsPhysics)\n│   ├─ Bodies too small or offset from sprite → Fix physics body size\n│   └─ Bodies never reach each other → Check collisionBitMask isn't blocking\n│\n└─ Are you modifying the world inside didBegin?\n    ├─ Removing nodes inside didBegin can cause missed callbacks\n    └─ FIX: Flag nodes for removal, process in update(_:)\n```\n\n### Quick Diagnostic Print\n\n```swift\nfunc didBegin(_ contact: SKPhysicsContact) {\n    print(\"CONTACT: \\(contact.bodyA.node?.name ?? \"nil\") (\\(contact.bodyA.categoryBitMask)) \u003C-> \\(contact.bodyB.node?.name ?? \"nil\") (\\(contact.bodyB.categoryBitMask))\")\n}\n```\n\nIf this never prints, the issue is delegate\u002Fbitmask setup. If it prints but with wrong bodies, the issue is bitmask values.\n\n---\n\n## Symptom 2: Objects Tunneling Through Walls\n\n**Time saved**: 20-60 min → 5 min\n\n```\nFast objects pass through thin walls\n│\n├─ Is the object moving faster than wall thickness per frame?\n│   ├─ At 60fps: max safe speed = wall_thickness × 60 pt\u002Fs\n│   ├─ A 10pt wall is safe up to ~600 pt\u002Fs\n│   └─ FIX: usesPreciseCollisionDetection = true on the fast object\n│\n├─ Is usesPreciseCollisionDetection enabled?\n│   ├─ Only needed on the MOVING object (not the wall)\n│   └─ FIX: fastObject.physicsBody?.usesPreciseCollisionDetection = true\n│\n├─ Is the wall an edge body?\n│   ├─ Edge bodies have zero area — tunneling is easier\n│   └─ FIX: Use volume body for walls (rectangleOf:) with isDynamic = false\n│\n├─ Is the wall thick enough?\n│   └─ FIX: Make walls at least 10pt thick for objects up to 600pt\u002Fs\n│\n└─ Are collision bitmasks correct?\n    ├─ Wall's categoryBitMask must be in object's collisionBitMask\n    └─ FIX: Verify with print: object.collisionBitMask & wall.categoryBitMask != 0\n```\n\n---\n\n## Symptom 3: Poor Frame Rate\n\n**Time saved**: 2-4 hours → 15-30 min\n\n```\nFPS below 60 (or 120 on ProMotion)\n│\n├─ Check showsNodeCount\n│   ├─ >1000 nodes → Offscreen nodes not removed\n│   │   ├─ Are you removing nodes that leave the screen?\n│   │   ├─ FIX: In update(), remove nodes outside visible area\n│   │   └─ FIX: Use object pooling for frequently spawned objects\n│   │\n│   ├─ 200-1000 nodes → Likely manageable, check draw count\n│   └─ \u003C200 nodes → Nodes aren't the problem, check below\n│\n├─ Check showsDrawCount\n│   ├─ >50 draw calls → Batching problem\n│   │   ├─ Using SKShapeNode for gameplay? → Replace with pre-rendered textures\n│   │   ├─ Sprites from different images? → Use texture atlas\n│   │   ├─ Sprites at different zPositions? → Consolidate layers\n│   │   └─ ignoresSiblingOrder = false? → Set to true\n│   │\n│   ├─ 10-50 draw calls → Acceptable for most games\n│   └─ \u003C10 draw calls → Drawing isn't the problem\n│\n├─ Physics expensive?\n│   ├─ Many texture-based physics bodies → Use circles\u002Frectangles\n│   ├─ usesPreciseCollisionDetection on too many bodies → Use only on fast objects\n│   ├─ Many contact callbacks firing → Reduce contactTestBitMask scope\n│   └─ Complex polygon bodies → Simplify to fewer vertices\n│\n├─ Particle overload?\n│   ├─ Multiple emitters active → Reduce particleBirthRate\n│   ├─ High particleLifetime → Reduce (fewer active particles)\n│   ├─ numParticlesToEmit = 0 (infinite) without cleanup → Add limits\n│   └─ FIX: Profile with Instruments → Time Profiler\n│\n├─ SKEffectNode without shouldRasterize?\n│   ├─ CIFilter re-renders every frame\n│   └─ FIX: effectNode.shouldRasterize = true (if content is static)\n│\n└─ Complex update() logic?\n    ├─ O(n²) collision checking? → Use physics engine instead\n    ├─ String-based enumerateChildNodes every frame? → Cache references\n    └─ Heavy computation in update? → Spread across frames or background\n```\n\n### Quick Performance Audit\n\n```swift\n#if DEBUG\nprivate var frameCount = 0\n#endif\n\noverride func update(_ currentTime: TimeInterval) {\n    #if DEBUG\n    frameCount += 1\n    if frameCount % 60 == 0 {\n        print(\"Nodes: \\(children.count)\")\n    }\n    #endif\n}\n```\n\n---\n\n## Symptom 4: Touches Not Registering\n\n**Time saved**: 15-45 min → 2 min\n\n```\ntouchesBegan not called on a node\n│\n├─ Is isUserInteractionEnabled = true on the node?\n│   ├─ SKScene: true by default\n│   ├─ All other SKNode subclasses: FALSE by default\n│   └─ FIX: node.isUserInteractionEnabled = true\n│\n├─ Is the node hidden or alpha = 0?\n│   ├─ Hidden nodes don't receive touches\n│   └─ FIX: Check node.isHidden and node.alpha\n│\n├─ Is another node on top intercepting touches?\n│   ├─ Higher zPosition nodes with isUserInteractionEnabled get first chance\n│   └─ DEBUG: Print nodes(at: touchLocation) to see what's there\n│\n├─ Is the touch in the correct coordinate space?\n│   ├─ Using touch.location(in: self.view)? → WRONG for SpriteKit\n│   └─ FIX: Use touch.location(in: self) for scene coordinates\n│        Or touch.location(in: targetNode) for node-local coordinates\n│\n├─ Is the physics body blocking touch pass-through?\n│   └─ Physics bodies don't affect touch handling — not the issue\n│\n└─ Is the node's frame correct?\n    ├─ SKNode (container) has zero frame — can't be hit-tested by area\n    ├─ SKSpriteNode frame matches texture size × scale\n    └─ FIX: Use contains(point) or nodes(at:) for manual hit testing\n```\n\n---\n\n## Symptom 5: Memory Spikes and Crashes\n\n**Time saved**: 1-3 hours → 15 min\n\n```\nMemory grows during gameplay\n│\n├─ Nodes accumulating? (Check showsNodeCount over time)\n│   ├─ Count increasing? → Nodes created but not removed\n│   │   ├─ Missing removeFromParent() for expired objects\n│   │   ├─ FIX: Add cleanup in update() or use SKAction.removeFromParent()\n│   │   └─ FIX: Implement object pooling for frequently spawned items\n│   │\n│   └─ Count stable? → Memory issue elsewhere\n│\n├─ Infinite particle emitters?\n│   ├─ numParticlesToEmit = 0 creates particles forever\n│   ├─ Each emitter accumulates particles up to birthRate × lifetime\n│   └─ FIX: Set finite numParticlesToEmit or manually stop and remove\n│\n├─ Texture caching?\n│   ├─ SKTexture(imageNamed:) caches — repeated calls don't leak\n│   ├─ SKTexture(cgImage:) from camera\u002Fdynamic sources → Not cached\n│   └─ FIX: Reuse texture references for dynamic textures\n│\n├─ Strong reference cycles in actions?\n│   ├─ SKAction.run { self.doSomething() } captures self strongly\n│   ├─ In repeatForever, this prevents scene deallocation\n│   └─ FIX: SKAction.run { [weak self] in self?.doSomething() }\n│\n├─ Scene not deallocating?\n│   ├─ Add deinit { print(\"Scene deallocated\") }\n│   ├─ If never prints → retain cycle\n│   ├─ Common: strong delegate, closure capture, NotificationCenter observer\n│   └─ FIX: Clean up in willMove(from:):\n│        removeAllActions()\n│        removeAllChildren()\n│        physicsWorld.contactDelegate = nil\n│\n└─ Instruments → Allocations\n    ├─ Filter by \"SK\" to see SpriteKit objects\n    ├─ Mark generation before\u002Fafter scene transition\n    └─ Persistent growth = leak\n```\n\n---\n\n## Symptom 6: Coordinate Confusion\n\n**Time saved**: 20-60 min → 5 min\n\n```\nPositions seem wrong or flipped\n│\n├─ Y-axis confusion?\n│   ├─ SpriteKit: origin at BOTTOM-LEFT, Y goes UP\n│   ├─ UIKit: origin at TOP-LEFT, Y goes DOWN\n│   └─ FIX: Use scene coordinate methods, not view coordinates\n│        touch.location(in: self)  ← CORRECT (scene space)\n│        touch.location(in: view)  ← WRONG (UIKit space, Y flipped)\n│\n├─ Anchor point confusion?\n│   ├─ Scene anchor (0,0) = bottom-left of view is scene origin\n│   ├─ Scene anchor (0.5,0.5) = center of view is scene origin\n│   ├─ Sprite anchor (0.5,0.5) = center of sprite is at position (default)\n│   ├─ Sprite anchor (0,0) = bottom-left of sprite is at position\n│   └─ FIX: Print anchorPoint values and draw expected position\n│\n├─ Parent coordinate space?\n│   ├─ node.position is relative to PARENT, not scene\n│   ├─ Child at (0,0) of parent at (100,100) is at scene (100,100)\n│   └─ FIX: Use convert(_:to:) and convert(_:from:) for cross-node coordinates\n│        let scenePos = node.convert(localPoint, to: scene)\n│        let localPos = node.convert(scenePoint, from: scene)\n│\n├─ Camera offset?\n│   ├─ Camera position offsets the visible area\n│   ├─ HUD attached to camera stays in place\n│   └─ FIX: For world coordinates, account for camera position\n│        scene.convertPoint(fromView: viewPoint)\n│\n└─ Scale mode cropping?\n    ├─ aspectFill crops edges — content at edges may be offscreen\n    └─ FIX: Keep important content in the \"safe area\" center\n```\n\n---\n\n## Symptom 7: Scene Transition Crashes\n\n**Time saved**: 30-90 min → 5 min\n\n```\nCrash during or after scene transition\n│\n├─ EXC_BAD_ACCESS after transition?\n│   ├─ Old scene deallocated while something still references it\n│   ├─ Common: Timer, NotificationCenter, delegate still referencing old scene\n│   └─ FIX: Clean up in willMove(from:):\n│        removeAllActions()\n│        removeAllChildren()\n│        physicsWorld.contactDelegate = nil\n│        \u002F\u002F Remove any NotificationCenter observers\n│\n├─ Crash in didMove(to:) of new scene?\n│   ├─ Accessing view before it's available\n│   ├─ Force-unwrapping optional that's nil during init\n│   └─ FIX: Use guard let view = self.view in didMove(to:)\n│\n├─ Memory spike during transition?\n│   ├─ Both scenes exist simultaneously during transition animation\n│   ├─ For large scenes, this doubles memory usage\n│   └─ FIX: Preload textures, reduce scene size, or use .fade transition\n│        (fade briefly shows neither scene, reducing peak memory)\n│\n├─ Nodes from old scene appearing in new scene?\n│   ├─ node.move(toParent:) during transition\n│   └─ FIX: Don't move nodes between scenes — recreate in new scene\n│\n└─ didMove(to:) called twice?\n    ├─ Presenting scene multiple times (button double-tap)\n    └─ FIX: Disable transition trigger after first tap\n         guard view?.scene !== nextScene else { return }\n```\n\n---\n\n## Common Mistakes\n\nThese mistakes cause the majority of SpriteKit issues. Check these first before diving into symptom trees.\n\n1. **Leaving default bitmasks** — `collisionBitMask` defaults to `0xFFFFFFFF` (collides with everything). Always set all three masks explicitly.\n2. **Forgetting `contactTestBitMask`** — Defaults to `0x00000000`. Contacts never fire without setting this.\n3. **Forgetting `physicsWorld.contactDelegate = self`** — Fixes ~30% of contact issues on its own.\n4. **Using SKShapeNode for gameplay** — Each instance = 1 draw call. Pre-render to texture with `view.texture(from:)`.\n5. **SKAction.move on physics bodies** — Actions override physics, causing jitter and missed collisions. Use forces\u002Fimpulses.\n6. **Strong self in action closures** — `SKAction.run { self.foo() }` in `repeatForever` creates retain cycles. Use `[weak self]`.\n7. **Not removing offscreen nodes** — Node count climbs silently, degrading performance.\n8. **Missing `isUserInteractionEnabled = true`** — Default is `false` on all non-scene nodes.\n\n---\n\n## Diagnostic Quick Reference Card\n\n| Symptom | First Check | Most Likely Cause |\n|---------|------------|-------------------|\n| Contacts don't fire | `contactDelegate` set? | Missing `contactTestBitMask` |\n| Tunneling | Object speed vs wall thickness | Missing `usesPreciseCollisionDetection` |\n| Low FPS | `showsDrawCount` | SKShapeNode in gameplay or missing atlas |\n| Touches broken | `isUserInteractionEnabled`? | Default is `false` on non-scene nodes |\n| Memory growth | `showsNodeCount` increasing? | Nodes created but never removed |\n| Wrong positions | Y-axis direction | Using view coordinates instead of scene |\n| Transition crash | `willMove(from:)` cleanup? | Strong references to old scene |\n\n## Resources\n\n**WWDC**: 2014-608, 2016-610, 2017-609\n\n**Docs**: \u002Fspritekit\u002Fskphysicsbody, \u002Fspritekit\u002Fmaximizing-node-drawing-performance\n\n**Skills**: axiom-spritekit, axiom-spritekit-ref\n\n",{"name":5,"license":15,"metadata":32,"description":7},{"version":33},"1.0.0","main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002FCharlesWiltgen\u002FAxiom\u002Faxiom-spritekit-diag",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":8,"skillName":5,"commands":44,"prompt":54,"zipAvailable":55},[45,48,51],{"tool":46,"command":47},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill axiom-spritekit-diag",{"tool":49,"command":50},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill axiom-spritekit-diag",{"tool":52,"command":53},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill axiom-spritekit-diag","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002FCharlesWiltgen\u002FAxiom\u002Faxiom-spritekit-diag\u002FSKILL.md",true,[57,63,69,73,77,81,87,91,95,99,103,107,111,115,119],{"path":58,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":61,"sourceHtmlUrl":62},"_AIWF_IMPORT.json","REFERENCE","参考文档",335,"https:\u002F\u002Fgithub.com\u002FiDorgham\u002FWorkspace-Factory\u002Fblob\u002Fmaster\u002Ffactory\u002Flibrary\u002Fskills\u002Fgithub_imports\u002Frelease-manager\u002F_AIWF_IMPORT.json",{"path":64,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":67,"sourceHtmlUrl":68},"assets\u002Fsample_commits.json","ASSET","资产文件",7426,"https:\u002F\u002Fgithub.com\u002FiDorgham\u002FWorkspace-Factory\u002Fblob\u002Fmaster\u002Ffactory\u002Flibrary\u002Fskills\u002Fgithub_imports\u002Frelease-manager\u002Fassets\u002Fsample_commits.json",{"path":70,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":71,"sourceHtmlUrl":72},"assets\u002Fsample_git_log_full.txt",6073,"https:\u002F\u002Fgithub.com\u002FiDorgham\u002FWorkspace-Factory\u002Fblob\u002Fmaster\u002Ffactory\u002Flibrary\u002Fskills\u002Fgithub_imports\u002Frelease-manager\u002Fassets\u002Fsample_git_log_full.txt",{"path":74,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":75,"sourceHtmlUrl":76},"assets\u002Fsample_git_log.txt",2004,"https:\u002F\u002Fgithub.com\u002FiDorgham\u002FWorkspace-Factory\u002Fblob\u002Fmaster\u002Ffactory\u002Flibrary\u002Fskills\u002Fgithub_imports\u002Frelease-manager\u002Fassets\u002Fsample_git_log.txt",{"path":78,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":79,"sourceHtmlUrl":80},"assets\u002Fsample_release_plan.json",8687,"https:\u002F\u002Fgithub.com\u002FiDorgham\u002FWorkspace-Factory\u002Fblob\u002Fmaster\u002Ffactory\u002Flibrary\u002Fskills\u002Fgithub_imports\u002Frelease-manager\u002Fassets\u002Fsample_release_plan.json",{"path":82,"resourceType":83,"resourceTypeDesc":84,"sizeBytes":85,"sourceHtmlUrl":86},"changelog_generator.py","SCRIPT","脚本",19675,"https:\u002F\u002Fgithub.com\u002FiDorgham\u002FWorkspace-Factory\u002Fblob\u002Fmaster\u002Ffactory\u002Flibrary\u002Fskills\u002Fgithub_imports\u002Frelease-manager\u002Fchangelog_generator.py",{"path":88,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":89,"sourceHtmlUrl":90},"expected_outputs\u002Fchangelog_example.md",1340,"https:\u002F\u002Fgithub.com\u002FiDorgham\u002FWorkspace-Factory\u002Fblob\u002Fmaster\u002Ffactory\u002Flibrary\u002Fskills\u002Fgithub_imports\u002Frelease-manager\u002Fexpected_outputs\u002Fchangelog_example.md",{"path":92,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":93,"sourceHtmlUrl":94},"expected_outputs\u002Frelease_readiness_example.txt",927,"https:\u002F\u002Fgithub.com\u002FiDorgham\u002FWorkspace-Factory\u002Fblob\u002Fmaster\u002Ffactory\u002Flibrary\u002Fskills\u002Fgithub_imports\u002Frelease-manager\u002Fexpected_outputs\u002Frelease_readiness_example.txt",{"path":96,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":97,"sourceHtmlUrl":98},"expected_outputs\u002Fversion_bump_example.txt",742,"https:\u002F\u002Fgithub.com\u002FiDorgham\u002FWorkspace-Factory\u002Fblob\u002Fmaster\u002Ffactory\u002Flibrary\u002Fskills\u002Fgithub_imports\u002Frelease-manager\u002Fexpected_outputs\u002Fversion_bump_example.txt",{"path":100,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":101,"sourceHtmlUrl":102},"README.md",14702,"https:\u002F\u002Fgithub.com\u002FiDorgham\u002FWorkspace-Factory\u002Fblob\u002Fmaster\u002Ffactory\u002Flibrary\u002Fskills\u002Fgithub_imports\u002Frelease-manager\u002FREADME.md",{"path":104,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":105,"sourceHtmlUrl":106},"references\u002Fconventional-commits-guide.md",9271,"https:\u002F\u002Fgithub.com\u002FiDorgham\u002FWorkspace-Factory\u002Fblob\u002Fmaster\u002Ffactory\u002Flibrary\u002Fskills\u002Fgithub_imports\u002Frelease-manager\u002Freferences\u002Fconventional-commits-guide.md",{"path":108,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":109,"sourceHtmlUrl":110},"references\u002Fhotfix-procedures.md",15809,"https:\u002F\u002Fgithub.com\u002FiDorgham\u002FWorkspace-Factory\u002Fblob\u002Fmaster\u002Ffactory\u002Flibrary\u002Fskills\u002Fgithub_imports\u002Frelease-manager\u002Freferences\u002Fhotfix-procedures.md",{"path":112,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":113,"sourceHtmlUrl":114},"references\u002Frelease-workflow-comparison.md",13335,"https:\u002F\u002Fgithub.com\u002FiDorgham\u002FWorkspace-Factory\u002Fblob\u002Fmaster\u002Ffactory\u002Flibrary\u002Fskills\u002Fgithub_imports\u002Frelease-manager\u002Freferences\u002Frelease-workflow-comparison.md",{"path":116,"resourceType":83,"resourceTypeDesc":84,"sizeBytes":117,"sourceHtmlUrl":118},"release_planner.py",39469,"https:\u002F\u002Fgithub.com\u002FiDorgham\u002FWorkspace-Factory\u002Fblob\u002Fmaster\u002Ffactory\u002Flibrary\u002Fskills\u002Fgithub_imports\u002Frelease-manager\u002Frelease_planner.py",{"path":120,"resourceType":83,"resourceTypeDesc":84,"sizeBytes":121,"sourceHtmlUrl":122},"version_bumper.py",23293,"https:\u002F\u002Fgithub.com\u002FiDorgham\u002FWorkspace-Factory\u002Fblob\u002Fmaster\u002Ffactory\u002Flibrary\u002Fskills\u002Fgithub_imports\u002Frelease-manager\u002Fversion_bumper.py",[124,138,148,157,163,170],{"skillNo":125,"name":126,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":127,"categories":128,"keywords":134,"publishedAt":27},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[129],{"categoryNo":130,"categoryName":131,"taxonomyType":132,"taxonomyTypeDesc":133},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[135,136,137],"model","model hierarchy","model hierarchy skill",{"skillNo":139,"name":140,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":141,"categories":142,"keywords":144,"publishedAt":27},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[143],{"categoryNo":130,"categoryName":131,"taxonomyType":132,"taxonomyTypeDesc":133},[145,146,147],"MCP","zoom","zoom mcp",{"skillNo":149,"name":150,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":151,"categories":152,"keywords":153,"publishedAt":27},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[154,155,156,146],"sdk","zoom apps sdk","apps",{"skillNo":158,"name":159,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":160,"categories":161,"keywords":162,"publishedAt":27},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[159],{"skillNo":164,"name":165,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":166,"categories":167,"keywords":169,"publishedAt":27},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[168],{"categoryNo":130,"categoryName":131,"taxonomyType":132,"taxonomyTypeDesc":133},[165],{"skillNo":171,"name":172,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":173,"categories":174,"keywords":175,"publishedAt":27},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[172]]