I have developed an iOS app using Sprite Kit. Anyone that has developed an iOS game with Sprite Kit knows of the label at the bottom corner with debugging information. I am trying to remove the debugging information on the bottom corner which gives the number of nodes and fps. (ex. 1 node 60.0 fps)
I tried the following code in the -(id)initWithSize:(CGSize)size
method in my .m
file but it doesn't seem to do anything. Is this the correct code for removing the debugging label or is there a better way to remove the label?
SKView *spriteView = (SKView *) self.view;
spriteView.showsNodeCount = NO;
spriteView.showsFPS = NO;
-(id)initWithSize:(CGSize)size
is not the method where you do this. I guess you are doing this in subclass of SKScene
. You should do it in ViewContoller
. Go to the ViewController
there in viewWillLayoutSubviews
. Just find that somewhere in your code you did this:
skView.showsFPS = YES;
skView.showsNodeCount = YES;
Just comment these two lines or do this:
skView.showsFPS = NO;
skView.showsNodeCount = NO;
Hope this helps.. :)
In Swift, you go to GameScene.swift, look at "skView.showsFPS" and "skView.showsNodeCount" repair from "true" to "false". Nodes and FPS will be removed at bottom of the screen! good luck
Set spriteView.showsDrawCount=NO
and check once. I think you have not set it to NO.
You could use a DEBUG
compiler directive, so this debugging label info is visible during development, but doesn't get included in the App Store release build.
// GameViewController.swift
override func viewDidLoad() {
super.viewDidLoad()
let scene = self.sceneManager.scene
scene.gameDelegate = self
let skView = self.view as! SKView
skView.ignoresSiblingOrder = true
#if DEBUG
skView.showsFPS = true
skView.showsNodeCount = true
#endif
skView.presentScene((scene as! SKScene))
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With