Sign In Register

How can we help you today?

Start a new topic
Answered

How to add score in game and update to leaderboard

Hi, i'm watch all the tutorial of making leaderboard in Unity, and i download the final project to test

I had test and reg some acc in portal.gamepart, and it showed perfectly in game (except some error "NullReferenceException: Object reference not set to an instance of an object" from GameState in Hierarchy)

But when i played the game, i got some score, and i pressed Leaderboard button, but it show nothing but "NullReferenceException: Object reference not set to an instance of an object"

Then i started again, and pressed Leaderboard button right on the start. It just showed the ID i test in portal, nothing of the score i just played.

So how can i add the score in game and update to leaderboard? And will that leaderboard show the score of best player in the game?


Best Answer

Hi Nguyen


In part 5 of the tutorial,Create a Leaderboard Entry Prefab part 5 drag the leaderboard object into assets to create a prefab.

The leaderboard script will be a component of the Leaderboard Panel Game Object.

Drag the prefab into the empty  Leaderboard Entry prefab field in the leaderboard script component.

All the scripts can be found here


Thanks

Katie





you forget to drag a prefab to a public game object

can you tell me where that prefab is in that sample: https://docs.gamesparks.net/tutorials/unity-tutorial-getting-profile-pictures-for-leaderboard-entries


i tried to find but founded nothing connect between score in game and the leaderboard, just the score link from portal

can you tell me where i find that prefab, and what script i missed for it? 

I tried to search but found nothing connect between score in game with leaderboard.

Answer

Hi Nguyen


In part 5 of the tutorial,Create a Leaderboard Entry Prefab part 5 drag the leaderboard object into assets to create a prefab.

The leaderboard script will be a component of the Leaderboard Panel Game Object.

Drag the prefab into the empty  Leaderboard Entry prefab field in the leaderboard script component.

All the scripts can be found here


Thanks

Katie




Login to post a comment