0

I'm having trouble converting my project to Swift 3. In previous version of Swift I can declare a class under GKComponentSystem like:

class EnemyMoveComponentSystem: GKComponentSystem {
}

However in swift 3 it forces me to add < GKComponent > in the end as:

class EnemyMoveComponentSystem: GKComponentSystem <GKComponent> {
    func updateWithDeltaTime(seconds: TimeInterval, gameScene: GameScene) {
        for component in components {
            print("something")
        }
    }
}

But it seems that I can't access each individual component within the system like before

for component in components {
     print("something")   
}

The line print("something") was never triggered. How can I fix this? Any help is appreciated!

Bob
  • 155
  • 1
  • 8

1 Answers1

0

Found out what the problem was. I forgot to link the entity to the component system. .addComponent(foundIn: Entity)

Bob
  • 155
  • 1
  • 8