Using SpriteKit Scene in watchOS 3+ with Xamarin

renzskarenzska USMember ✭✭
edited November 3 in Xamarin.iOS

I've gone through the following tutorial for Xcode to add create a SpriteKit Scene: http://martiancraft.com/blog/2017/09/spritekit-tutorial/

I'm able to add a SpriteKit Scene holder to the Interface.storyboard, but I have no way to reference it in code on the Xamarin side of things. The swift code example is as follows, adding the @IBOutlet, but I am unable to translate that in Xamarin. I need access to the WKInterfaceSKScene. Also, the SKScene() has three overloads, but none match the SKScene(filenamed: string) option to load the .sks file I created.

import WatchKit
import Foundation
import SpriteKit

class InterfaceController: WKInterfaceController {

  @IBOutlet weak var spriteKitScene: WKInterfaceSKScene!

  override func awake(withContext context: Any?) {
    super.awake(withContext: context)

    if let scene: SKScene = SKScene(fileNamed: "ProgressIndicatorScene.sks") {
      self.spriteKitScene.presentScene(scene, transition: .crossFade(withDuration: 0.1))
    }
  }
}

Any help would be appreciated.

Thanks,

John

Sign In or Register to comment.