skreferencenode

Add SKReferenceNode/SKScene to another SKScene in SpriteKit

筅森魡賤 提交于 2019-12-18 05:12:15
问题 I would like to add a SKScene to my main GameScene. SKReferenceNode seems to be a good solution. I have : - GameScene.sks (main scene) - Countdown.sks (scene to add to GameScene) - Countdown.swift (Custom class, how does to init it? SKScene ? SKReferenceNode ? SKNode) I don't know how to add programmatically my countdown using my class Countdown. I tried: let path = Bundle.main.path(forResource: "Countdown", ofType: "sks") let cd = SKReferenceNode (url: NSURL (fileURLWithPath: path!) as URL)