我有一个坐在那里时不使用内存的SKSpriteNode。一旦我指定了physicsBody,内存就会以每秒0.5MB的速度上升。我有其他物理机构但是当它们被添加时,它们正常工作。有一个名为" player"的精灵。我用它来显示播放器。我做了这个功能,以确保问题被隔离。 (IOS 10.3.3)
func createPlayerCollisionBox() {
let playerDummy = SKSpriteNode()
playerDummy.position = player.position
playerDummy.name = "dummy"
playerDummy.physicsBody = SKPhysicsBody.init(circleOfRadius: 40)
playerDummy.physicsBody?.isDynamic = false
playerDummy.physicsBody?.usesPreciseCollisionDetection = false
playerDummy.physicsBody?.categoryBitMask = playerCategory
playerDummy.physicsBody?.collisionBitMask = UInt32(8)
playerDummy.physicsBody?.contactTestBitMask = playerCategory | enemyCategory
self.addChild(playerDummy)
}