0

I'm trying to capture an entire Spritekit scene for the purpose of later magnify particular areas. To capture the scene I tried doing:

if let texture = view.texture(from: node) {
    let sprite = SKSpriteNode(texture:texture)
    // ... do whatever with sprite
}

Which works fine with anything besides the scene itself. For example, if i try this code inside the didMove() method passing self as "node" i get an empty/black texture as a result.

Doe01
  • 13
  • 5
  • Do you call it before the node is added as child to the scene? This would return a clear color background. – sabi Feb 14 '18 at 07:47
  • I'm calling it on the scene itself. After i've added a background and some sprites. – Doe01 Feb 15 '18 at 18:56
  • Maybe didMove is a little early. Did you try to place a button to take the screen? – sabi Feb 15 '18 at 20:02
  • I've tried it in different methods. Same result. I've also tried a different approach, as suggested here (last answer): https://stackoverflow.com/questions/19571357/ios-sprite-kit-screengrab. This works but it's very slow and generates an extreme drop in fps. To be honest, i'm thinking of changing a mechanic so to avoid the need for screen-capturing all together. Grazie lo stesso :) – Doe01 Feb 15 '18 at 20:31

0 Answers0