バグかどうかはわかりませんが、スプライトにカスタムクラス名を設定しても完全に無視されるようです。
ドラッグしたアセットを試してみた後、空のノードを使用して、Monkey クラスの関連付けを完全に無視し、生の SKSpriteNode を作成するだけです。
モンキー ノードのコードは次のとおりです。
import Foundation
import SpriteKit
class Monkey: SKSpriteNode{
let monkeyWalkAtlas = SKTextureAtlas(named: "MonkeyWalk")
override init(texture: SKTexture?, color: NSColor, size: CGSize) {
super.init(texture: texture, color: color, size: size)
print("Monkey.init debug")
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
}
注: .sks ノードのカスタム クラスは、xcode7 で新しく追加されました。
2015 年 6 月 21 日編集
セットアップを簡素化しましたが、iOS9 シミュレーターでコンパイル/実行する際の問題は解決しません。デフォルトの SpriteKit テンプレートを使用してプロジェクトを作成し、GameSence を次のもの (および空の Monkey クラス) を持つように変更しました。
import SpriteKit
class GameScene: SKScene {
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
print("touch down")
/* Called when a touch begins */
for node in self.children {
print(node)
}
}
override func update(currentTime: CFTimeInterval) {
/* Called before each frame is rendered */
}
}
public class Monkey: SKSpriteNode {}
GameScene.sks に空のノードをドラッグし、カスタム クラスを Monkey に設定しましたが、タッチダウンしてサブ ノードを印刷すると、次のようになります。
touch down
<SKSpriteNode> name:'SKNode_0' texture:['nil'] position:{753.5, 333.5} scale:{1.00, 1.00} size:{0, 0} anchor:{0, 0} rotation:0.00