SpriteKit

RSS for tag

Drawing shapes, particles, text, images, and video in two dimensions using SpriteKit.

SpriteKit Documentation

Posts under SpriteKit subtopic

Post

Replies

Boosts

Views

Activity

How can i fix Thread 1: signal SIGABRT Error?
Hello, I am building game with SpriteKit. 2 or 3 days ago my code worked perfectly then some project files paths changed in my computer. So now my code is running on preview but it's not running on simulator. I got error message like this Thread 1: signal SIGABRT 2022-04-17 23:48:25.927505+0300 MultiplayerGame[58416:1308997] fopen failed for data file: errno = 2 (No such file or directory) 2022-04-17 23:48:25.927569+0300 MultiplayerGame[58416:1308997] Errors found! Invalidating cache... 2022-04-17 23:48:26.015933+0300 MultiplayerGame[58416:1309280] Execution of the command buffer was aborted due to an error during execution. The operation couldn’t be completed. (MTLCommandBufferErrorDomain error 9.) 2022-04-17 23:48:26.016392+0300 MultiplayerGame[58416:1309280] Execution of the command buffer was aborted due to an error during execution. The operation couldn’t be completed. (MTLCommandBufferErrorDomain error 9.) XPC_ERROR_CONNECTION_INTERRUPTED dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLD_LIBRARY_PATH=/Users/mkg/Library/Developer/Xcode/DerivedData/MultiplayerGame-ghupaqvlksldiogzatxbetsvshfx/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMainThreadChecker.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMTLCapture.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib DYLD_FRAMEWORK_PATH=/Users/mkg/Library/Developer/Xcode/DerivedData/MultiplayerGame-ghupaqvlksldiogzatxbetsvshfx/Build/Products/Debug-iphonesimulator:/Users/mkg/Library/Developer/Xcode/DerivedData/MultiplayerGame-ghupaqvlksldiogzatxbetsvshfx/Build/Products/Debug-iphonesimulator/PackageFrameworks CoreSimulator 802.6 - Device: iPhone 12 Pro Max (50569CD6-26AA-45EF-BE07-3B5F9702915E) - Runtime: iOS 15.4 (19E240) - DeviceType: iPhone 12 Pro Max (lldb)
2
0
1.3k
Apr ’22
SKScene displayed as a SCNMaterial
Hi, I just wanted to display a SpriteKit Scene in a SCNPlane. So I set the the SCNMaterial contents to my SKScene, but instead of getting the scene I'm getting a grey plane. This is my code by the way: var mainScene: SKScene {     let scene = Game()     scene.size = CGSize(width: 1024, height: 1024)     scene.scaleMode = .resizeFill     scene.backgroundColor = .purple     scene.view?.backgroundColor = .purple     scene.view?.allowsTransparency = false     return scene } func initMainScene() -> SceneView {     mainScene.view?.isPaused = false     let scene = SCNScene()     let mainSceneMaterial = SCNMaterial()     mainSceneMaterial.normal.contents = mainScene     mainSceneMaterial.isDoubleSided = true     let planeGeometry = SCNPlane(width: 1, height: 1)     planeGeometry.materials = [mainSceneMaterial]     let plane: SCNNode = SCNNode(geometry: planeGeometry)     let camera: SCNNode = SCNNode()     camera.name = "Camera"     camera.camera = SCNCamera()     camera.position = SCNVector3(x: 0.0, y: 0.0, z: 4.0)     let light: SCNNode = SCNNode()     light.light =  SCNLight()     light.light!.type = .omni     light.position = SCNVector3(x: 1.5, y: 1.5, z: 1.5)     scene.rootNode.addChildNode(camera)     scene.rootNode.addChildNode(light)     scene.rootNode.addChildNode(plane)     return SceneView(         scene: scene,         pointOfView: scene.rootNode.childNode(withName: "Camera", recursively: false),         options: []     ) } Here is the screenshot: Also, my SpriteKit scene has touchesBegan and touchesMoved functions implemented, will those events still work if I embed the scene in the SCNMaterial? Thanks very much 🙏
2
0
802
Apr ’22
Any tutorials for macOS Swift Game Development?
Working with a student who wants to build a game in SpriteKit as a Mac app, and I was wondering if there are any good tutorials out there for this? Secondary, is there a better way to do key controls for a macOS games in Swift? Using the KeyDown function with the key code has been more of an annoying process than I would like. Is there any way of simply doing if keyPressed == "D" {...}?
3
0
3.1k
Apr ’22
SpriteKit Crash Only when WatchOS >= 8.X
-[SKLabelNode _isEligibleForFocus]: unrecognized selector sent to instance 0x1164f040 ( 0 CoreFoundation 0x1a90ce68 26D96C7E-9A5C-3F48-9DBA-7AC4B4E0F3FD + 786024 1 libobjc.A.dylib 0x23add390 objc_exception_throw + 56 2 CoreFoundation 0x1a9a04f8 26D96C7E-9A5C-3F48-9DBA-7AC4B4E0F3FD + 1389816 3 UIKitCore 0x1e5b6394 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 11969428 4 CoreFoundation 0x1a860c14 26D96C7E-9A5C-3F48-9DBA-7AC4B4E0F3FD + 80916 5 CoreFoundation 0x1a85efcc _CF_forwarding_prep_0 + 92 6 SpriteKit 0x3cb782f8 B5D8103E-85CD-33A3-BB6D-F318B027A10D + 287480 7 SpriteKit 0x3cbb224c B5D8103E-85CD-33A3-BB6D-F318B027A10D + 524876 8 SpriteKit 0x3cbb2128 B5D8103E-85CD-33A3-BB6D-F318B027A10D + 524584 9 SpriteKit 0x3cb781f8 B5D8103E-85CD-33A3-BB6D-F318B027A10D + 287224 10 SpriteKit 0x3cb96940 B5D8103E-85CD-33A3-BB6D-F318B027A10D + 411968 11 UIKitCore 0x1e15388c C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7370892 12 UIKitCore 0x1e153b44 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7371588 13 UIKitCore 0x1e9474e8 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 15709416 14 UIKitCore 0x1e15388c C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7370892 15 UIKitCore 0x1e153b44 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7371588 16 UIKitCore 0x1e9474e8 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 15709416 17 UIKitCore 0x1e15388c C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7370892 18 UIKitCore 0x1e153b44 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7371588 19 UIKitCore 0x1e9474e8 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 15709416 20 UIKitCore 0x1e15388c C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7370892 21 UIKitCore 0x1e152684 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7366276 22 UIKitCore 0x1e151d74 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7363956 23 UIKitCore 0x1e154768 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7374696 24 UIKitCore 0x1e14a5a8 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7333288 25 UIKitCore 0x1e121d30 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7167280 26 UIKitCore 0x1e121804 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7165956 27 UIKitCore 0x1e121744 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7165764 28 UIKitCore 0x1e122514 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7169300 29 UIKitCore 0x1e12263c C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7169596 30 UIKitCore 0x1e12263c C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7169596 31 UIKitCore 0x1e12263c C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7169596 32 UIKitCore 0x1e12263c C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7169596 33 UIKitCore 0x1e12236c C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7168876 34 UIKitCore 0x1e122c20 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7171104 35 UIKitCore 0x1e1669d4 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7449044 36 UIKitCore 0x1e1667cc C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7448524 37 UIKitCore 0x1e1666a8 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7448232 38 UIKitCore 0x1e157ff8 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7389176 39 UIKitCore 0x1e15bc28 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7404584 40 UIKitCore 0x1dae83a4 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 639908 41 UIKitCore 0x1da52ac8 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 27336 42 UIKitCore 0x1da4f674 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 13940 43 UIKitCore 0x1da52d88 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 28040 44 UIKitCore 0x1da6a550 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 124240 45 CoreFoundation 0x1a85bf5c 26D96C7E-9A5C-3F48-9DBA-7AC4B4E0F3FD + 61276 46 CoreFoundation 0x1a88570c 26D96C7E-9A5C-3F48-9DBA-7AC4B4E0F3FD + 231180 47 CoreFoundation 0x1a8522cc 26D96C7E-9A5C-3F48-9DBA-7AC4B4E0F3FD + 21196 48 CoreFoundation 0x1a89a250 CFRunLoopRunSpecific + 572 49 GraphicsServices 0x3dee19a8 GSEventRunModal + 160 50 UIKitCore 0x1dbff4c4 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 1782980 51 UIKitCore 0x1db9a32c UIApplicationMain + 140 52 WatchKit 0x239bc8a0 WKExtensionMain + 776 53 dyld 0x051d91ec start + 472 )
4
0
1.7k
Mar ’22
Notification Banners Freeze Game
Hey everyone,In one of my apps I've been working on where SKShapeNodes fall from the top to the bottom via gravity, if the player recieves a notification in iOS 9 (such as a text message), the game temporarily freezes for around 1 second and then resumes but the nodes have jumped ahead, as if the nodes are still falling but failing to display for that second. Has anyone else come across this? Is there a solution or is it just best to hold out hope for iOS 10? Unfortunately this issue makes the game near unplayable 😟Cheers
2
0
1.2k
Feb ’22
my segue transition goes upward instead of sideways and does not completely cover screen
In my app using storyboard and spritekit developed in Xcode 12.5.1 uses segue connected button to bring up another storyboard which presents a scene and show a sprite. The segue sequence triggered by the use pressing the Play button and running the segue shows an upward transition and the scene with the sprite that when clicked animates that sprite. My problem is I was getting two events that are causing me issues. The first is that I was expecting a sidewards transition for the Show segue. and second that the scene only covers 2 thirds on the screen not all of it. Screenshots of. Xcode showing main storyboard and segue connections, simulator app Settings, app Game initial view and app Game with sprite animated. Anyone any hints for me for explanation of the first event and how to resolve the second which is spoiling my development time?
2
0
842
Feb ’22
Failure to unarchive a sprite kit particle file
Hi all,I'm having trouble in trying to access the content of a sprite kit particle file in a way that conforms with the recent deprecation of several functions in NSKeyedArchiver.Briefly, my project contains a file named "ParticleSmoke.sks", which I used to access easily with the following lines of code: NSString *smokePath = [[NSBundle mainBundle] pathForResource:@"ParticleSmoke" ofType:@"sks"]; SKEmitterNode* smoke = [NSKeyedUnarchiver unarchiveObjectWithFile:smokePath];now that the unarchiving function has been deprecated, I fail to use the (poorly documented) unarchivedObjectOfClass function. Especially, the code below returns nil. NSString *smokePath = [[NSBundle mainBundle] pathForResource:@"ParticleSmoke" ofType:@"sks"]; NSData* smokeData = [NSData dataWithContentsOfFile:smokePath]; NSError* error=nil; Class cls = [SKEmitterNode class]; SKEmitterNode* smoke = (SKEmitterNode*)[NSKeyedUnarchiver unarchivedObjectOfClass:cls fromData:smokeData error:&error];Unexpectedly, the content of "error" (code 4864) was@"NSDebugDescription" : @"value for key 'NS.objects' was of unexpected class 'NSColor'. Allowed classes are '{(\n SKKeyframeSequence,\n NSArray,\n NSNumber,\n NSMutableArray\n)}'."Has anyone an idea to fix this issue?Thanks for your help....
2
0
1.9k
Jan ’22
xcode12 spritekit image shown as red X
I am trying to get a simple animated sprite image in a very basic game using SpriteKit and Xcode 12. I am creating an skspritenode with image named and setting its position form the touch point and adding it as a child but a red X image is shown on the simulator of iPhone 8 Plus. I have attached screenshots. Can someone help me with this?
2
0
933
Jan ’22
It is writeing a problem"Editor placeholder in source file" and i down't now what to do now
Im programmin a plong game import SpriteKit import GameplayKit class GameScene: SKScene {     var ball = SKSpriteNode()     var enemy = SKSpriteNode()     var main = SKSpriteNode()     override func didMove(to view: SKView) {         ball = self.childNode(withName: "ball") as! SKSpriteNode         enemy = self.childNode(withName: "enemy") as! SKSpriteNode         main = self.childNode(withName: "main") as! SKSpriteNode                  ball.physicsBody?.applyImpulse(CGVector(dx: -20, dy: -20))                  let border = SKPhysicsBody (edgeLoopFrom: self.frame)         border.friction = 0         border.restitution = 1         self.physicsBody = border     }     override func touchesBegan(_ touches: Set, with event: UIEvent?) {     for touch in touches {             let location = touch.location(in: self)                      main.run (SKAction.moveTo(x: location.x, duration: 0.2))                      }     }     override func touchesMoved(_ touches: Set, with event: UIEvent?) {     for touch in touches {             let location = touch.location(in: self)                      main.run (SKAction.moveTo(x: location.x, duration: 0.2))                      }     }          override func update(_ currentTime: TimeInterval) {         enemy.run(SKAction.moveTo(x: ball.position.x, duration: 1.0))     } } and it comms a problem "Editor placeholder in source file" what i can do now??
0
0
1.1k
Jan ’22
Xcode 12.5.1 SpriteKit SkScene tile set images not showing
When I start my project the tile added to my SKScene using the editor do not appear until after I have clicked on the tiles that was selected in the scene setup. Anyone any ideas why> Also should these tiles be in the list shown to the left of the scene as those sprites (not part of the tileset) I dragged into the scene are. I have attached screen shots of at start and after clicking the tiles.
1
0
702
Jan ’22
Will this be your last SpriteKit project?
The project I'm currently working on will be my last SpriteKit project. With about 14k lines of code I can't afford to switch to another library so I'm stuck for now. I'll never make the same mistake again and rely on this framework though.I had also started sketching out other projects with SpriteKit but will abandon all of them and rebuild with other tools.With all the problems SpriteKit has in iOS 9 and Apple's lack of communication about the issue, have you decided to abandon the framework as well?
19
0
8.8k
Jan ’22
Help with SpritKit's Tile Set in SwiftUI. Looking for suggestions
I wanted to build a game for my class like "UniWar: Multiplayer Strategy." It is a hexagonal tile 2d strategy game. Everywhere I search online, everything points to using SpriteKit and using the tile sets to accomplish what I want. The problem I am running into is that there is very little if not poor examples online of using Tile Sets and SpriteKit (or maybe they are super good but my novice skills is getting in the way). Every tutorial I have found is either 6 years old and is unrecognizable or Apple Documentation that tends to explain what it is but not how to use it. I should mention a couple things, one, yes, I am a novice swift programmer and, two, I learn best by doing not by being told (so for example, someone showing me how to use it helps a lot more than "use this code"). I really want to learn so does anyone have some suggestions for learning Tile Sets and SpriteKit in general? P.S. I am also not above a course that costs something (I have already searched Udemy for a course on this but couldn't find one)
1
0
627
Jan ’22
Unable to Install Tap on Input Node in MacOS for Live Audio Speech Recognition
I'm developing a game that will use speech recognition to execute various commands. I am using code from Apple's Recognizing Speech in Live Audio documentation page. When I run this in a Swift Playground, it works just fine. However, when I make a SpriteKit game application (basic setup from Xcode's "New Project" menu option), I get the following error: required condition is false: IsFormatSampleRateAndChannelCountValid(hwFormat) Upon further research, it appears that my input node has no channels. The following is the relevant portion of my code, along with debug output: let inputNode = audioEngine.inputNode print("Number of inputs: \(inputNode.numberOfInputs)") // 1 print("Input Format: \(inputNode.inputFormat(forBus: 0))") // <AVAudioFormat 0x600001bcf200: 0 ch, 0 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved> let channelCount = inputNode.inputFormat(forBus: 0).channelCount print("Channel Count: \(channelCount)") // 0 <== Agrees with the inputFormat output listed previously // Configure the microphone input. print("Number of outputs: \(inputNode.numberOfOutputs)") // 1 let recordingFormat = inputNode.outputFormat(forBus: 0) print("Output Format: \(recordingFormat)") // <AVAudioFormat 0x600001bf3160: 2 ch, 44100 Hz, Float32, non-inter> inputNode.installTap(onBus: 0, bufferSize: 256, format: recordingFormat, block: audioTap) // <== This is where the error occurs. // NOTE: 'audioTap' is a function defined in this class. Using this defined function instead of an inline, anonymous function. The code snippet is included in the game's AppDelegate class (which includes import statements for Cocoa, AVFoundation, and Speech), and executes during its applicationDidFinishLaunching function. I'm having trouble understanding why Playground works, but a game app doesn't work. Do I need to do something specific to get the application to recognize the microphone? NOTE: This if for MacOS, NOT iOS. While the "How To" documentation cited earlier indicates iOS, Apple stated at WWDC19 that it is now supported on the MacOS. NOTE: I have included the NSSpeechRecognitionUsageDescription key in the applications plist, and successfully acknowledged the authorization request for the microphone.
1
0
2.4k
Dec ’21
SpriteKit sprite node lags when added to the scene
Hello! I'm using SpriteKit for my application, and when I add an SKSpriteNode into the scene it lags and the FPS drops from 60 to 45. To make sure this isn't a code issue, I tested this in an app instead of a playground and it worked fine. Will I get penalized for poor performance or is there a way to solve this issue?Thank you 🙂
Replies
1
Boosts
0
Views
1.2k
Activity
Apr ’22
How can i fix Thread 1: signal SIGABRT Error?
Hello, I am building game with SpriteKit. 2 or 3 days ago my code worked perfectly then some project files paths changed in my computer. So now my code is running on preview but it's not running on simulator. I got error message like this Thread 1: signal SIGABRT 2022-04-17 23:48:25.927505+0300 MultiplayerGame[58416:1308997] fopen failed for data file: errno = 2 (No such file or directory) 2022-04-17 23:48:25.927569+0300 MultiplayerGame[58416:1308997] Errors found! Invalidating cache... 2022-04-17 23:48:26.015933+0300 MultiplayerGame[58416:1309280] Execution of the command buffer was aborted due to an error during execution. The operation couldn’t be completed. (MTLCommandBufferErrorDomain error 9.) 2022-04-17 23:48:26.016392+0300 MultiplayerGame[58416:1309280] Execution of the command buffer was aborted due to an error during execution. The operation couldn’t be completed. (MTLCommandBufferErrorDomain error 9.) XPC_ERROR_CONNECTION_INTERRUPTED dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLD_LIBRARY_PATH=/Users/mkg/Library/Developer/Xcode/DerivedData/MultiplayerGame-ghupaqvlksldiogzatxbetsvshfx/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMainThreadChecker.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMTLCapture.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib DYLD_FRAMEWORK_PATH=/Users/mkg/Library/Developer/Xcode/DerivedData/MultiplayerGame-ghupaqvlksldiogzatxbetsvshfx/Build/Products/Debug-iphonesimulator:/Users/mkg/Library/Developer/Xcode/DerivedData/MultiplayerGame-ghupaqvlksldiogzatxbetsvshfx/Build/Products/Debug-iphonesimulator/PackageFrameworks CoreSimulator 802.6 - Device: iPhone 12 Pro Max (50569CD6-26AA-45EF-BE07-3B5F9702915E) - Runtime: iOS 15.4 (19E240) - DeviceType: iPhone 12 Pro Max (lldb)
Replies
2
Boosts
0
Views
1.3k
Activity
Apr ’22
SKScene displayed as a SCNMaterial
Hi, I just wanted to display a SpriteKit Scene in a SCNPlane. So I set the the SCNMaterial contents to my SKScene, but instead of getting the scene I'm getting a grey plane. This is my code by the way: var mainScene: SKScene {     let scene = Game()     scene.size = CGSize(width: 1024, height: 1024)     scene.scaleMode = .resizeFill     scene.backgroundColor = .purple     scene.view?.backgroundColor = .purple     scene.view?.allowsTransparency = false     return scene } func initMainScene() -> SceneView {     mainScene.view?.isPaused = false     let scene = SCNScene()     let mainSceneMaterial = SCNMaterial()     mainSceneMaterial.normal.contents = mainScene     mainSceneMaterial.isDoubleSided = true     let planeGeometry = SCNPlane(width: 1, height: 1)     planeGeometry.materials = [mainSceneMaterial]     let plane: SCNNode = SCNNode(geometry: planeGeometry)     let camera: SCNNode = SCNNode()     camera.name = "Camera"     camera.camera = SCNCamera()     camera.position = SCNVector3(x: 0.0, y: 0.0, z: 4.0)     let light: SCNNode = SCNNode()     light.light =  SCNLight()     light.light!.type = .omni     light.position = SCNVector3(x: 1.5, y: 1.5, z: 1.5)     scene.rootNode.addChildNode(camera)     scene.rootNode.addChildNode(light)     scene.rootNode.addChildNode(plane)     return SceneView(         scene: scene,         pointOfView: scene.rootNode.childNode(withName: "Camera", recursively: false),         options: []     ) } Here is the screenshot: Also, my SpriteKit scene has touchesBegan and touchesMoved functions implemented, will those events still work if I embed the scene in the SCNMaterial? Thanks very much 🙏
Replies
2
Boosts
0
Views
802
Activity
Apr ’22
SpriteKit Performance
Would it be possible to work with thousands of physical bodies in SpriteKit?
Replies
2
Boosts
0
Views
1.2k
Activity
Apr ’22
Is it possible to render a SpriteKit Scene into a SceneKit Plane?
Hi, I just wanted to add a 3D perspective to my SpriteKit Scene, so I wondered if I render the SpriteKit Scene as a material of SCNGeometry is possible. If not, is there another way to give a 3D perspective to a SpriteKit Scene. Thanks very much 🙏
Replies
1
Boosts
0
Views
746
Activity
Apr ’22
Any tutorials for macOS Swift Game Development?
Working with a student who wants to build a game in SpriteKit as a Mac app, and I was wondering if there are any good tutorials out there for this? Secondary, is there a better way to do key controls for a macOS games in Swift? Using the KeyDown function with the key code has been more of an annoying process than I would like. Is there any way of simply doing if keyPressed == "D" {...}?
Replies
3
Boosts
0
Views
3.1k
Activity
Apr ’22
SpriteKit Crash Only when WatchOS >= 8.X
-[SKLabelNode _isEligibleForFocus]: unrecognized selector sent to instance 0x1164f040 ( 0 CoreFoundation 0x1a90ce68 26D96C7E-9A5C-3F48-9DBA-7AC4B4E0F3FD + 786024 1 libobjc.A.dylib 0x23add390 objc_exception_throw + 56 2 CoreFoundation 0x1a9a04f8 26D96C7E-9A5C-3F48-9DBA-7AC4B4E0F3FD + 1389816 3 UIKitCore 0x1e5b6394 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 11969428 4 CoreFoundation 0x1a860c14 26D96C7E-9A5C-3F48-9DBA-7AC4B4E0F3FD + 80916 5 CoreFoundation 0x1a85efcc _CF_forwarding_prep_0 + 92 6 SpriteKit 0x3cb782f8 B5D8103E-85CD-33A3-BB6D-F318B027A10D + 287480 7 SpriteKit 0x3cbb224c B5D8103E-85CD-33A3-BB6D-F318B027A10D + 524876 8 SpriteKit 0x3cbb2128 B5D8103E-85CD-33A3-BB6D-F318B027A10D + 524584 9 SpriteKit 0x3cb781f8 B5D8103E-85CD-33A3-BB6D-F318B027A10D + 287224 10 SpriteKit 0x3cb96940 B5D8103E-85CD-33A3-BB6D-F318B027A10D + 411968 11 UIKitCore 0x1e15388c C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7370892 12 UIKitCore 0x1e153b44 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7371588 13 UIKitCore 0x1e9474e8 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 15709416 14 UIKitCore 0x1e15388c C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7370892 15 UIKitCore 0x1e153b44 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7371588 16 UIKitCore 0x1e9474e8 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 15709416 17 UIKitCore 0x1e15388c C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7370892 18 UIKitCore 0x1e153b44 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7371588 19 UIKitCore 0x1e9474e8 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 15709416 20 UIKitCore 0x1e15388c C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7370892 21 UIKitCore 0x1e152684 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7366276 22 UIKitCore 0x1e151d74 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7363956 23 UIKitCore 0x1e154768 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7374696 24 UIKitCore 0x1e14a5a8 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7333288 25 UIKitCore 0x1e121d30 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7167280 26 UIKitCore 0x1e121804 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7165956 27 UIKitCore 0x1e121744 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7165764 28 UIKitCore 0x1e122514 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7169300 29 UIKitCore 0x1e12263c C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7169596 30 UIKitCore 0x1e12263c C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7169596 31 UIKitCore 0x1e12263c C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7169596 32 UIKitCore 0x1e12263c C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7169596 33 UIKitCore 0x1e12236c C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7168876 34 UIKitCore 0x1e122c20 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7171104 35 UIKitCore 0x1e1669d4 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7449044 36 UIKitCore 0x1e1667cc C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7448524 37 UIKitCore 0x1e1666a8 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7448232 38 UIKitCore 0x1e157ff8 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7389176 39 UIKitCore 0x1e15bc28 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 7404584 40 UIKitCore 0x1dae83a4 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 639908 41 UIKitCore 0x1da52ac8 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 27336 42 UIKitCore 0x1da4f674 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 13940 43 UIKitCore 0x1da52d88 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 28040 44 UIKitCore 0x1da6a550 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 124240 45 CoreFoundation 0x1a85bf5c 26D96C7E-9A5C-3F48-9DBA-7AC4B4E0F3FD + 61276 46 CoreFoundation 0x1a88570c 26D96C7E-9A5C-3F48-9DBA-7AC4B4E0F3FD + 231180 47 CoreFoundation 0x1a8522cc 26D96C7E-9A5C-3F48-9DBA-7AC4B4E0F3FD + 21196 48 CoreFoundation 0x1a89a250 CFRunLoopRunSpecific + 572 49 GraphicsServices 0x3dee19a8 GSEventRunModal + 160 50 UIKitCore 0x1dbff4c4 C3A646A8-7F5C-3446-A1A5-D8692AB71AC3 + 1782980 51 UIKitCore 0x1db9a32c UIApplicationMain + 140 52 WatchKit 0x239bc8a0 WKExtensionMain + 776 53 dyld 0x051d91ec start + 472 )
Replies
4
Boosts
0
Views
1.7k
Activity
Mar ’22
Notification Banners Freeze Game
Hey everyone,In one of my apps I've been working on where SKShapeNodes fall from the top to the bottom via gravity, if the player recieves a notification in iOS 9 (such as a text message), the game temporarily freezes for around 1 second and then resumes but the nodes have jumped ahead, as if the nodes are still falling but failing to display for that second. Has anyone else come across this? Is there a solution or is it just best to hold out hope for iOS 10? Unfortunately this issue makes the game near unplayable 😟Cheers
Replies
2
Boosts
0
Views
1.2k
Activity
Feb ’22
my segue transition goes upward instead of sideways and does not completely cover screen
In my app using storyboard and spritekit developed in Xcode 12.5.1 uses segue connected button to bring up another storyboard which presents a scene and show a sprite. The segue sequence triggered by the use pressing the Play button and running the segue shows an upward transition and the scene with the sprite that when clicked animates that sprite. My problem is I was getting two events that are causing me issues. The first is that I was expecting a sidewards transition for the Show segue. and second that the scene only covers 2 thirds on the screen not all of it. Screenshots of. Xcode showing main storyboard and segue connections, simulator app Settings, app Game initial view and app Game with sprite animated. Anyone any hints for me for explanation of the first event and how to resolve the second which is spoiling my development time?
Replies
2
Boosts
0
Views
842
Activity
Feb ’22
Can i use spritekit without xcode ?
Can i use spritekit without xcode and just using visual studio code ?
Replies
1
Boosts
0
Views
869
Activity
Jan ’22
Failure to unarchive a sprite kit particle file
Hi all,I'm having trouble in trying to access the content of a sprite kit particle file in a way that conforms with the recent deprecation of several functions in NSKeyedArchiver.Briefly, my project contains a file named "ParticleSmoke.sks", which I used to access easily with the following lines of code: NSString *smokePath = [[NSBundle mainBundle] pathForResource:@"ParticleSmoke" ofType:@"sks"]; SKEmitterNode* smoke = [NSKeyedUnarchiver unarchiveObjectWithFile:smokePath];now that the unarchiving function has been deprecated, I fail to use the (poorly documented) unarchivedObjectOfClass function. Especially, the code below returns nil. NSString *smokePath = [[NSBundle mainBundle] pathForResource:@"ParticleSmoke" ofType:@"sks"]; NSData* smokeData = [NSData dataWithContentsOfFile:smokePath]; NSError* error=nil; Class cls = [SKEmitterNode class]; SKEmitterNode* smoke = (SKEmitterNode*)[NSKeyedUnarchiver unarchivedObjectOfClass:cls fromData:smokeData error:&amp;error];Unexpectedly, the content of "error" (code 4864) was@"NSDebugDescription" : @"value for key 'NS.objects' was of unexpected class 'NSColor'. Allowed classes are '{(\n SKKeyframeSequence,\n NSArray,\n NSNumber,\n NSMutableArray\n)}'."Has anyone an idea to fix this issue?Thanks for your help....
Replies
2
Boosts
0
Views
1.9k
Activity
Jan ’22
xcode12 spritekit image shown as red X
I am trying to get a simple animated sprite image in a very basic game using SpriteKit and Xcode 12. I am creating an skspritenode with image named and setting its position form the touch point and adding it as a child but a red X image is shown on the simulator of iPhone 8 Plus. I have attached screenshots. Can someone help me with this?
Replies
2
Boosts
0
Views
933
Activity
Jan ’22
It is writeing a problem"Editor placeholder in source file" and i down't now what to do now
Im programmin a plong game import SpriteKit import GameplayKit class GameScene: SKScene {     var ball = SKSpriteNode()     var enemy = SKSpriteNode()     var main = SKSpriteNode()     override func didMove(to view: SKView) {         ball = self.childNode(withName: "ball") as! SKSpriteNode         enemy = self.childNode(withName: "enemy") as! SKSpriteNode         main = self.childNode(withName: "main") as! SKSpriteNode                  ball.physicsBody?.applyImpulse(CGVector(dx: -20, dy: -20))                  let border = SKPhysicsBody (edgeLoopFrom: self.frame)         border.friction = 0         border.restitution = 1         self.physicsBody = border     }     override func touchesBegan(_ touches: Set, with event: UIEvent?) {     for touch in touches {             let location = touch.location(in: self)                      main.run (SKAction.moveTo(x: location.x, duration: 0.2))                      }     }     override func touchesMoved(_ touches: Set, with event: UIEvent?) {     for touch in touches {             let location = touch.location(in: self)                      main.run (SKAction.moveTo(x: location.x, duration: 0.2))                      }     }          override func update(_ currentTime: TimeInterval) {         enemy.run(SKAction.moveTo(x: ball.position.x, duration: 1.0))     } } and it comms a problem "Editor placeholder in source file" what i can do now??
Replies
0
Boosts
0
Views
1.1k
Activity
Jan ’22
is there a way to make physics body border line more visible
I am having problems with verifying the SKPhysicsBody setup which is not working. I am having difficulty seeing the PhysicsBody border line in the scene. Is there any way of making the border bigger, different colour, etc?
Replies
1
Boosts
0
Views
574
Activity
Jan ’22
Xcode 12.5.1 SKTexture error loading image resource
I have not been able to find a solution to this problem. Screenshots attached for run error, asset setup, code used to load image. Anyone any hints for me on this?
Replies
1
Boosts
0
Views
782
Activity
Jan ’22
Xcode 12.5.1 SpriteKit SkScene tile set images not showing
When I start my project the tile added to my SKScene using the editor do not appear until after I have clicked on the tiles that was selected in the scene setup. Anyone any ideas why> Also should these tiles be in the list shown to the left of the scene as those sprites (not part of the tileset) I dragged into the scene are. I have attached screen shots of at start and after clicking the tiles.
Replies
1
Boosts
0
Views
702
Activity
Jan ’22
xcode 12.5.1 SpriteKit scene addchild fails reason already present
Using Xcode 12.5.1 and getting uncaught exception when trying to add child to the scene. Attached screenshot shows the code being used and output containing the prints data and the error. Anyone any ideas for me.
Replies
5
Boosts
0
Views
818
Activity
Jan ’22
Will this be your last SpriteKit project?
The project I'm currently working on will be my last SpriteKit project. With about 14k lines of code I can't afford to switch to another library so I'm stuck for now. I'll never make the same mistake again and rely on this framework though.I had also started sketching out other projects with SpriteKit but will abandon all of them and rebuild with other tools.With all the problems SpriteKit has in iOS 9 and Apple's lack of communication about the issue, have you decided to abandon the framework as well?
Replies
19
Boosts
0
Views
8.8k
Activity
Jan ’22
Help with SpritKit's Tile Set in SwiftUI. Looking for suggestions
I wanted to build a game for my class like "UniWar: Multiplayer Strategy." It is a hexagonal tile 2d strategy game. Everywhere I search online, everything points to using SpriteKit and using the tile sets to accomplish what I want. The problem I am running into is that there is very little if not poor examples online of using Tile Sets and SpriteKit (or maybe they are super good but my novice skills is getting in the way). Every tutorial I have found is either 6 years old and is unrecognizable or Apple Documentation that tends to explain what it is but not how to use it. I should mention a couple things, one, yes, I am a novice swift programmer and, two, I learn best by doing not by being told (so for example, someone showing me how to use it helps a lot more than "use this code"). I really want to learn so does anyone have some suggestions for learning Tile Sets and SpriteKit in general? P.S. I am also not above a course that costs something (I have already searched Udemy for a course on this but couldn't find one)
Replies
1
Boosts
0
Views
627
Activity
Jan ’22
Unable to Install Tap on Input Node in MacOS for Live Audio Speech Recognition
I'm developing a game that will use speech recognition to execute various commands. I am using code from Apple's Recognizing Speech in Live Audio documentation page. When I run this in a Swift Playground, it works just fine. However, when I make a SpriteKit game application (basic setup from Xcode's "New Project" menu option), I get the following error: required condition is false: IsFormatSampleRateAndChannelCountValid(hwFormat) Upon further research, it appears that my input node has no channels. The following is the relevant portion of my code, along with debug output: let inputNode = audioEngine.inputNode print("Number of inputs: \(inputNode.numberOfInputs)") // 1 print("Input Format: \(inputNode.inputFormat(forBus: 0))") // <AVAudioFormat 0x600001bcf200: 0 ch, 0 Hz, 'lpcm' (0x00000029) 32-bit little-endian float, deinterleaved> let channelCount = inputNode.inputFormat(forBus: 0).channelCount print("Channel Count: \(channelCount)") // 0 <== Agrees with the inputFormat output listed previously // Configure the microphone input. print("Number of outputs: \(inputNode.numberOfOutputs)") // 1 let recordingFormat = inputNode.outputFormat(forBus: 0) print("Output Format: \(recordingFormat)") // <AVAudioFormat 0x600001bf3160: 2 ch, 44100 Hz, Float32, non-inter> inputNode.installTap(onBus: 0, bufferSize: 256, format: recordingFormat, block: audioTap) // <== This is where the error occurs. // NOTE: 'audioTap' is a function defined in this class. Using this defined function instead of an inline, anonymous function. The code snippet is included in the game's AppDelegate class (which includes import statements for Cocoa, AVFoundation, and Speech), and executes during its applicationDidFinishLaunching function. I'm having trouble understanding why Playground works, but a game app doesn't work. Do I need to do something specific to get the application to recognize the microphone? NOTE: This if for MacOS, NOT iOS. While the "How To" documentation cited earlier indicates iOS, Apple stated at WWDC19 that it is now supported on the MacOS. NOTE: I have included the NSSpeechRecognitionUsageDescription key in the applications plist, and successfully acknowledged the authorization request for the microphone.
Replies
1
Boosts
0
Views
2.4k
Activity
Dec ’21