0

I'm trying to add .mov files to my .sks file in scene editor. Is it possible? If so, how do you do it? This is as far as i got, am i going the right direction?

var videoNode: SKVideoNode?

func check() {
   videoNode = childNode(withName: "video") as? SKVideoNode
   videoNode = SKVideoNode(fileNamed: "FantasyBasketball-Score-Winning-4-20210112.mov") 
   print(videoNode)
}


override func sceneDidLoad() {
        check()
}

However, the videoNode returns nil after running.

4

1 回答 1

0

I don't believe there is a Video node in the sks editor, therefore you'll have to add it in code. You could try

func check() {
    let videoNode = SKVideoNode(fileNamed: "FantasyBasketball-Score-Winning-4-20210112.mov"
    addChild(videoNode)
    videoNode.play()
}

override func sceneDidLoad() {
        check()
}
于 2021-01-26T23:51:30.540 回答