Sprite Kit: Custom Class in Reference Node not loading
| Originator: | mc | ||
| Number: | rdar://21838916 | Date Originated: | 2015-07-15 |
| Status: | Won't Fix | Resolved: | 2016-01-06 |
| Product: | iOS SDK | Product Version: | 9.0 (13A4280e) |
| Classification: | Serious Bug | Reproducible: | Always |
I would think that an instance of the Custom Class of the Scene being reference is initialised, but it's not. To do that, the only way I found was to do
override func didMoveToView(view: SKView) {
loadReferenceNode("ReferenceScene")
referenceNode?.test()
}
func loadReferenceNode(name: String) {
let referenceScene = SKScene(fileNamed: name)
let childNode = childNodeWithName(name)
referenceScene?.position = childNode!.position
childNode?.removeFromParent()
for child in referenceScene!.children {
if let referenceChild = child as? ReferenceNode {
referenceNode = referenceChild
}
child.removeFromParent()
addChild(child)
}
}
Otherwise I have no clue how to call the "test()" method from within "GameScene".
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!
Apple says they won't fix this anytime soon :(