Can't create SKSpriteNode in playground with imageNamed initializer in Swift

I get Unknown error

compiler generated or runtime in Swift when trying to create SKSpriteNode like below in playground file.

let healthSprite = SKSpriteNode(imageNamed: "health")

Unknown error

I have a health.png placed inside a Resources folder inside a playground file as shown here https://github.com/jocelynlih/SwiftGameBook/tree/master/Playgrounds/Life%20Line%20Node.playground/Resources

This is a known issue and someone knows how to fix it. I can create a UIImage using UIImage(named: "health")

, but if I create SKTexture

using an image I get the sameUnknown error

+3


source to share





All Articles