modalmusic
modalmusic

Reputation: 71

SKAction is called twice every time (Swift 3)

This has been driving me mad. This code:

 func nowPrint() {
        print("RUN")
    }


    run(SKAction.repeatForever(
        SKAction.sequence([
            SKAction.run(addSpawn), SKAction.run(nowPrint),
            SKAction.wait(forDuration: universalDuration/10)
            ])
    )
    )

(where universalDuration = 100) seems to be called twice, because every 10 seconds the console window prints "RUN" twice.

This code is contained in the sceneDidLoad() function, if that makes a difference.

Upvotes: 2

Views: 163

Answers (1)

modalmusic
modalmusic

Reputation: 71

The solution - change sceneDidLoad to didMove(to view).

Upvotes: 2

Related Questions