Post

Replies

Boosts

Views

Activity

Reply to Xcode 16 beta 5 MainActor errors in a Swift 6 project while working in beta 4
Xcode 16.1 beta seems to be having the same issue. To test, I started from the default "Game" project template with SpriteKit and changed to GameScene.swift file to something simple like this: // GameScene.swift import SpriteKit import GameplayKit class GameScene: SKScene { // GameScene is @MainActor as a subclass of SKNode var label : SKLabelNode = SKLabelNode(text: "Initial text") override func didMove(to view: SKView) { addChild(label) } } @MainActor final class State: GKState { unowned private let scene: GameScene init(scene: GameScene) { self.scene = scene } override func didEnter(from previousState: GKState?) { scene.label.text = "Entered State" // Main actor-isolated property 'label' can not be referenced from a nonisolated context // Main actor-isolated property 'text' can not be mutated from a nonisolated context } } It seems that the @MainActor tag on the class State is not working for methods that were overridden. This is most likely because GKState is not marked so its methods are nonisolated. But what is the solution in this case?
Aug ’24
Reply to Possible to batch SKEmitterNodes?
I noticed the same thing, every SKEmitterNode increases the draw call count. Were you able to do anything to batch these draw calls? In my case, all these SKEmitterNodes use the same texture, default blend mode, zero particleColorBlendFactor and have the same targetNode with the same particleZPosition.
Apr ’23
Reply to SKView showsFields draws only on a portion of the screen
Looks like there is more to SKView.showsFields. When showsFields is true, if you have an SKFieldNode.customField({}) in the scene, the custom block is called for what appears to be physics bodies to the far top right, with different positions, zero velocity, 1.0 mass, 0.0 charge. Same, this can be easily replicated using the Game Playground, by adding an SKFieldNode.customField({}) with a block that prints out the arguments. If SKView.showsFields is false, the block is not called, as it should be. Feedback report has been updated but there's no update on it.
Apr ’22