Uncaught ReferenceError: sdkbox is not defined

I’m using cocos creator, after integrating plugin ‘PluginSdkboxPlay’, I’m using it to submit score… I’ve successfully build and compiled the project. But, I’m getting error while running… Both in simulator and browser. And installed apk isn’t breaking/crashing while playing the game.
Any help in resolving this is greatly appreciated! Thanks in advance.

Code Snippet:

gameOver () {
  // Back ground Music stop. Game over & dead sound playback
  cc.audioEngine.stopMusic();
  cc.audioEngine.playEffect(this.dieAudio);
  cc.audioEngine.playEffect(this.gameOverAudio);
  // Stop Hurdles
        D.HurdleBeamManager.reset();
        this.state = State.Over;
  // Showing GameOver Menu (With score and restart button)
        this.gameOverMenu.active = true;
        this.gameOverMenu.getComponent('GameOverMenu').score.string = this.score;
  //**Error here: Uncaught ReferenceError: sdkbox is not defined
        sdkbox.PluginSdkboxPlay.submitScore( leaderboard1, this.score );
}

SDKBOX does not work in the browser or simulator. SDKBOX is a plugin later for the native platforms, mostly Android and iOS.

You should wrap those calls in an if statement. Something like:

if ( cc.sys.isMobile() ) {
    sdkbox.PluginSdkboxPlay.submitScore( leaderboard1, this.score );
}

This will ensure that the sdkbox call is made only on platforms that support it, and allow for testing on the more convenient platforms.

2 Likes

Thanks for your reply. That explains…
My objective is to show leader board to my game.
Quick question: Does this call shows up the leader board in the native platforms?
i.e… when I install the apk on my android/iPhone??

   showleaderBoard() {
		if(cc.sys.isMobile) {
			sdkbox.PluginSdkboxPlay.showLeaderboard( leaderboard1 );
		}
	}

Just curious

Can someone please help me out.
Nothing is showing up in my game when I used
sdkbox.PluginSdkboxPlay.showLeaderboard( leaderboard1 );

SDKBOX dose not support Web or simulator yet.

Thanks nite this was resolved please help me with the other thread below