创建physicsBody时,SKSpriteNode会占用内存

时间:2017-08-03 09:06:44

标签: swift xcode memory sprite-kit collision

我有一个坐在那里时不使用内存的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)
}

注意:当您离开现场并返回时,内存不会回落。
记忆: Memory increasing

0 个答案:

没有答案