2

How can I take an SKSpriteNode and all its child SKSpriteNodes and merge them down into a single flattened SKSpriteNode with no children?

Thanks.

Newt-7
  • 275
  • 1
  • 3
  • 9

1 Answers1

1

Create a texture of the node and create a new sprite from that texture:

SKTexture* tex = [self.scene.view textureFromNode:parentSprite];
SKSpriteNode* newSprite = [SKSpriteNode spriteNodeWithTexture:tex];

PS: be sure not to run this in init otherwise self.view will be nil.

CodeSmile
  • 64,284
  • 20
  • 132
  • 217