skscene

After Closing SKScene, Memory Remains High

别等时光非礼了梦想. 提交于 2019-12-04 02:44:32
I use a dispatch_once NSObject to create data pointers. So all game asset pointers are made when the main viewcontroller appears. In order to play a game, the user taps a UIButton corresponding to a particular level on a UIViewController . Let me call it LevelSelectionController. When the game is over, the user will tap a label ( SKLabel ). And all actions and nodes will be removed. [self removeAllActions]; [self removeAllChildren]; [self removeFromParent]; Moreover, an SKScene subclass for a particular level delegates the task of returning the user to LevelSelectionController to the

Memory leak when presenting SpriteKit scenes

杀马特。学长 韩版系。学妹 提交于 2019-12-03 22:32:57
问题 I have an SKScene which is the overworld for my 2D game. It's like a neighborhood that the player can explore. The neighborhood is full of houses. Players can freely enter and exit houses. When the player enters a house, I call skView.presentScene(newHouse) to present the interior of the house as a new scene. When the player exits the house, I call skView.presentScene(overworld) to present the neighborhood again. The player is likely to enter & exit houses many times as they explore the

SpriteKit Memory leaks changing Scenes containing SKTileMapNodes

戏子无情 提交于 2019-12-03 14:15:30
问题 I am trying to create a simple 2d platform game using Swift, SpriteKit, and SKTileMaps. But every time i change between scenes containing SKTileMaps I see a lot of memory leaks in the Xcode Instruments. I have recreated the problem as simple as I can. I am using a .sks file to create the scene and this file only contains 1 tileMap filled with some tiles. The code in the view controller for presenting the scene: if let view = self.view as! SKView? { let scene = LoadingScene(size: CGSize(width:

Difference between paused property of SKScene and SKView

爱⌒轻易说出口 提交于 2019-12-03 06:13:09
I am pausing my SKScene using the following code: self.paused = YES; However, according to this answer by Andrey Gordeev , one can also pause a scene using this line: self.view.paused = YES; I would like to understand what difference it would make to call the either (or both) to pause a scene. Andrey Gordeev Pausing SKView stops calling update: method for SKScene . Pausing SKScene doesn't do that. I usually pause both SKScene and SKView EDIT: As of iOS9 pausing the scene will pause the update: method. The effect is the same. You still have the paused property on the scene because it's a

SpriteKit Memory leaks changing Scenes containing SKTileMapNodes

末鹿安然 提交于 2019-12-03 04:06:07
I am trying to create a simple 2d platform game using Swift, SpriteKit, and SKTileMaps. But every time i change between scenes containing SKTileMaps I see a lot of memory leaks in the Xcode Instruments. I have recreated the problem as simple as I can. I am using a .sks file to create the scene and this file only contains 1 tileMap filled with some tiles. The code in the view controller for presenting the scene: if let view = self.view as! SKView? { let scene = LoadingScene(size: CGSize(width: 2048, height: 1536)) scene.scaleMode = .aspectFill view.presentScene(scene) The code for the scene:

SpriteKit: why does SKView disappear at one height but appears at another height? What's the maximum height for SKView?

一个人想着一个人 提交于 2019-12-02 18:28:08
问题 The code below shows a SKView until you change skHeight to 2050 or some higher value like 5000. 1) How can you make the SKView appear even at heights of 2050 or 5000? 2) What's the maximum size for SKViews ? To reproduce: 1) Run the code below. You will see the SKView represented as a gray window. 2) Change skHeight to 2050 or 5000. The SKView no longer appears. class TestViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Create SKView let skHeight =

How do I present UIViewController from SKscene with social framework?

那年仲夏 提交于 2019-12-02 16:06:20
问题 I am making a game like Flappy Bird. How do I present a UIViewController from SKScene? First of all, I tell my environments Mac OS X 10.9 Xcode 5.0.2 Sprite Kit(framework), social.framework(framework) are added in my project My goal is to display a "Share" button upon Game Over. Tapping the share button image should present a SLComposeViewController (Twitter Share). The contents of the scene should not change. I'd like to solve bellow issue and change display from GameOverScene to tweetSheet

Presenting a UIViewController from SKScene shows black screen

时光怂恿深爱的人放手 提交于 2019-12-02 07:51:04
问题 This code, intending to present the user with the UIViewController "menu", instead greets them with a black screen. let currentViewController:UIViewController=UIApplication.shared.keyWindow!.rootViewController! let mymenu = menu() currentViewController.present(mymenu, animated: true, completion: nil) I'm transitioning from a SKScene . 回答1: To present a SKScene from another SKScene you should do for example : let nextScene = MainScene(size: self.scene!.size) self.scene?.view?.presentScene

iPhone 5s SpriteKit drawing oddities

拈花ヽ惹草 提交于 2019-12-02 06:59:29
I understand that the iPhone 5s has a pixel resolution of 640 x 1136 and a point resolution of 320 x 568 (for backward compatibility with non-Retina devices). The problem/confusion/oddity seems to come in when I'm working with SpriteKit. Example: I'm drawing a line from bottom-left corner (0, 0) to top-right corner (width, height). The result was that the line was drawn almost halfway. And indeed when i print out the screen size, it should 320 x 568. So i decided to draw from (0, 0) to (width * 2, height * 2). And of course, this printed out 640 x 1136. So the oddity is this: Even though I'm

Presenting a UIViewController from SKScene shows black screen

本秂侑毒 提交于 2019-12-02 02:53:28
This code, intending to present the user with the UIViewController "menu", instead greets them with a black screen. let currentViewController:UIViewController=UIApplication.shared.keyWindow!.rootViewController! let mymenu = menu() currentViewController.present(mymenu, animated: true, completion: nil) I'm transitioning from a SKScene . To present a SKScene from another SKScene you should do for example : let nextScene = MainScene(size: self.scene!.size) self.scene?.view?.presentScene(nextScene, transition: SKTransition.doorway(withDuration: 1)) You don't need to retrieve your