assigned variable get nil

Player: GKGameModel {  }

GameScene: SKNode {

         var board: Board

         let playA = Player( )

        let playB = Player( )

        board.players = [playA, playB] as [GKGameModelPlayer]

       }

Board: GKGameModel {                              

     var players: [GKGameModelPlayer]?              

  func gameModelUpdates(for player: GKGameModelPlayer) -> [GKGameModelUpdate]?{

                 guard let players = self.players else{ fatalError(“players nil”)}        / /appear “fatal error: players nil “

        }

  

i don`t know why the assigned variable is nil, i want conveying player to Board`s function.  thanks for your appriciation.

Powered by WPeMatico

About

You may also like...

Comments are closed.