Can't open particle SKS files
Do NOT open your SKS particle files in Xcode 6 GM! There is a bug that is causing them to be saved as SKScenes, which leads to the file becoming corrupt.
You need to download Xcode 6.1 beta which fixes the bug in Apple's sprite kit editor.
However, if your file is already corrupted you will need to recreate the particle SKS file from scratch. But if you have a backup like I did you won't need to do this.
But if you don't have a backup, here is a tip for helping you to view your properties of your corrupt emitter so you quickly recreate the SKS file. If you right click your corrupt SKS file and open in Sprite Kit Editor, Xcode will not crash because it will actually select the scene that it incorrectly wrapped your emitter in. And from there you can view the properties of your emitter. I would then take a picture so that now when you recreate the SKS file you can quickly set its properties again. Remember you can't just click the file you need to right click and open in Sprite Kit Editor.
In the future I suggest everyone backup your SKS files as they are and have been very buggy throughout the Xcode 6 betas, and this major bug in the GM is unacceptable. I would also stay away from using SKS files for your scenes because I've had some strange bugs and crashes and the last thing you want is to have to recreate an entire scene! The SKS files can be useful but they weren't ready for release IMO. So either continuously backup your SKS files or just make your scenes and emitters programmatically until Sprite Kit Editor becomes more stable.
Xcode 7 crashes when trying to open .sks files
It does look like, at least for me, that xcode 8 may be required to open these files. So try installing that version and it should work.
Using particle effects or animated sks files to create filled letters
Not ideal, but an easy to achieve:
override func didMove(to view: SKView) {
if let nodeToMask = SKEmitterNode(fileNamed: "firelfies") {
backgroundColor = .black
let cropNode = SKCropNode()
cropNode.position = CGPoint(x: frame.midX, y: frame.midY)
cropNode.zPosition = 1
let mask = SKLabelNode(fontNamed: "ArialMT")
mask.text = "MASK"
mask.fontColor = .green
mask.fontSize = 185
cropNode.maskNode = mask
nodeToMask.position = CGPoint(x: 0, y: 0)
nodeToMask.name = "character"
cropNode.addChild(nodeToMask)
addChild(cropNode)
}
}
I think the code is self-explanatory, but basically, you just use text as a mask of a crop node, and you mask an emitter. Here is the result:
The thing with this implementation is that sparkles don't go outside of the letter bounds.
Swift and Sprite Kit - unarchiving a particle emitter (sks) file
Try unwrapping the filePath:
_bloodEmitter = NSKeyedUnarchiver.unarchiveObjectWithFile(NSBundle.mainBundle().pathForResource("Blood", ofType: "sks")!)
Are SpriteKit Scene (.sks) files necessary in my project?
No, you don't need them. You can create all your SKScene
content directly in Swift code.
Just keep in mind that Xcode 8 support for SpriteKit Scenes is pretty nice, providing a nice game design/production workflow. In particular, you can create *.sks
files with simple, reusable nodes (e.g., crates, monsters, coins, etc) and use them across your game.
Having said that, please double check your *.sks
files are actually empty before deleting them all ;-)
Related Topics
How to Add Constraints Programmatically to My Uilabel
Getting Unresolved Identifier 'Self' in Swiftui Code Trying to Use Timer.Scheduledtimer
Saving Array to Realm in Swift
Generate an Rsa Public/Private Key Pair
Why Does Swift Return an Unexpected Pointer When Converting an Optional String into an Unsafepointer
How to Change Gb-2312 Encoding to Utf-8
Typecasting or Initialization, Which Is Better in Swift
Get Index in Foreach in Swiftui
Open a Viewcontroller from Remote Notification
How to Connect Aksequencer to a Akcallbackinstrument
Use Uipangesturerecognizer to Drag Uiview Inside Limited Area
What's the Difference Between a View and a Viewcontroller
Checking When a Date Has Passed - Swift
How to Combine Two Strings (Date & Time) into a New Date in Swift 3
Why Can't I Pass an Implicitly Unwrapped Optional as an Unsafemutablepointer
Sum Values of Properties Inside Array of Custom Objects Using Reduce