1

Is there any way to unarchive a custom SKSpriteNode subclass from a SpriteKit Scene File (the one that ends *.sks)? I am using the SKNode extension unarchiveFromFile(file) which returns a scene that I am then copying the SKSpriteNode I need out of.

I could inside my custom SKSpriteNode subclass unarchive the sprite from the *.sks file and then copy over the data I need (i.e. SKTexture, size, position, SKPhysicsBody etc.) in the init. I guess I could also make an SKNode subclass wrapper and assign the sprite from the archive to a sprite property, I am just curious if I am missing something obvious.

rakeshbs
  • 24,392
  • 7
  • 73
  • 63
fuzzygoat
  • 26,573
  • 48
  • 165
  • 294
  • Is this related to your problem http://stackoverflow.com/questions/25271208/cast-to-typeofself ? – Martin R Mar 03 '15 at 19:19
  • This is related but I was more asking about being able to unarchive an SKSpriteNode subclass from an *.sks file. I believe you can't do this currently, there are workarounds by replacing classes in the unarchiver but thats a little bit over kill for what I am after. I think my best option is to use SKNode markers in the *.sks file and then replace them as I unarchive. Thank you for your comment, much appreciated. – fuzzygoat Mar 04 '15 at 11:10

0 Answers0