Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sprite Kit: Remove debugging label at bottom corner

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;
like image 807
MSU_Bulldog Avatar asked Apr 17 '14 05:04

MSU_Bulldog


4 Answers

-(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.. :)

like image 101
Rashad Avatar answered Oct 22 '22 17:10

Rashad


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

like image 43
Dai Hoang Kim Avatar answered Oct 22 '22 17:10

Dai Hoang Kim


Set spriteView.showsDrawCount=NO and check once. I think you have not set it to NO.

like image 1
Pooja M. Bohora Avatar answered Oct 22 '22 19:10

Pooja M. Bohora


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))
}
like image 1
Mark Brownsword Avatar answered Oct 22 '22 18:10

Mark Brownsword