I have asked this similar question a while ago, but since then it seems SKNode now has this nifty initializer init?(fileNamed filename: String) that unarchives the scene from an .sks file. The thing is, this initializer is on SKNode, not SKScene, so I am trying (mostly out of programmer curiosity) to use it on a node, any node, that is not SKScene or a subclass of it.
Now I know I can put the node I want as a child of the .sks file, load the scene using SKNode(fileNamed:... and then pull out the node using childNode(withName:.... But since the fileNamed initializer is declared for SKNode, you should be able to directly load an SKNode and cut out the SKScene middle man. If this is not possible, then why wouldn't the initializer be declared in SKScene?
So, I have tried this, but it appears the root node for the .sks file is strongly suggested to be a descendant of SKScene as seen in this dialog box:
Ignoring caution, I made an .sks file that looks like this:
I made the root Scene be a custom class of an SKNode subclass, and I got this build error:
[MyProject.SolarSystemNode setBlendMode:]: unrecognized selector sent to instance
This is because the blendMode property is declared on SKEffectNode. The class inheritance goes SKNode -> SKEffectNode -> SKScene. So apparently the fileNamed: initializer, though declared on SKNode calls a property on SKEffectNode.
So, is it possible to load an SKNode directly, or am I stuck arranging my node tree like this:
and loading the scene first then pulling out the solarSystemNode? If it is possible to load an SKNode directly from an .sks file with the fileNamed initializer, then could someone please show me an example how, preferably in Swift 3? If it is not possible, could someone please tell me why the fileNamed initializer would be declared on SKNode and not SKScene?


