# Create Unity leaderboard

**URL:** <https://forum.heroiclabs.com/t/create-unity-leaderboard/1215>\
**Category:** Game Design\
**Created:** [December 8, 2020, 11:50am UTC](https://forum.heroiclabs.com/t/create-unity-leaderboard/1215 "2020-12-08T11:50:08Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![hooman](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/hooman/32/420_2.png) [@hooman](https://forum.heroiclabs.com/u/hooman)\
**Post date:** [December 8, 2020, 11:50am UTC](https://forum.heroiclabs.com/t/create-unity-leaderboard/1215/1 "2020-12-08T11:50:08Z")

</div>

hello, is there any way to create a leaderboard without server-side code or Lua, Go languages?  
I should learn about Lua or go? I’m implementing server-side logic by unity and I can not communicate with Nakama.

---

<div class="post-metadata">

**Author:** ![novabyte](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/novabyte/32/1324_2.png) [@novabyte](https://forum.heroiclabs.com/u/novabyte)\
**Post date:** [December 9, 2020, 7:57am UTC](https://forum.heroiclabs.com/t/create-unity-leaderboard/1215/2 "2020-12-09T07:57:02Z")

</div>

Hi @hooman welcome 👋

> is there any way to create a leaderboard without server-side code or Lua, Go languages?

The server requires a leaderboard to be created ahead of use via a small amount of server code in Lua or in Go. This prevents bad actors from abusing the server API to create leaderboards that were not intended for the game. These authoritative controls are important to protect the integrity of the game design and your server infrastructure.

> I’m implementing server-side logic by unity and I can not communicate with Nakama.

What does this mean? You want to use Nakama server but cannot communicate with it. How would this work with your game project?

---

<div class="post-metadata">

**Author:** ![hooman](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/hooman/32/420_2.png) [@hooman](https://forum.heroiclabs.com/u/hooman)\
**Post date:** [December 9, 2020, 11:44pm UTC](https://forum.heroiclabs.com/t/create-unity-leaderboard/1215/3 "2020-12-09T23:44:22Z")

</div>

thank you, I want to use unity ECS and Transport to create my server, then I can use ECS physics. but I need authentications, leaderboards, and other social features that take a long time to write. I’m not using Nakama in realtime.

---

<div class="post-metadata">

**Author:** ![novabyte](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/novabyte/32/1324_2.png) [@novabyte](https://forum.heroiclabs.com/u/novabyte)\
**Post date:** [December 11, 2020, 8:05am UTC](https://forum.heroiclabs.com/t/create-unity-leaderboard/1215/4 "2020-12-11T08:05:28Z")

</div>

@hooman I understand now. Thanks for the added details.

You can of course use Nakama for the social, core game data, and realtime but non-multiplayer features in your game project. We have lots of game teams who combine Nakama with another system for their project if the requirements need it.

As for how to create a leaderboard from Unity do you need to create leaderboards dynamically from the headless instance?

---

<div class="post-metadata">

**Author:** ![hooman](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/hooman/32/420_2.png) [@hooman](https://forum.heroiclabs.com/u/hooman)\
**Post date:** [December 11, 2020, 6:19pm UTC](https://forum.heroiclabs.com/t/create-unity-leaderboard/1215/5 "2020-12-11T18:19:40Z")

</div>

thank you for your answer and sorry for my English.  
I have the wrong title on this topic.  
there are two pieces of feedback on this topic.  
at my requirement, I can not create or remove leaderboards from the dashboard and I should change server code to create or remove Leaderboards.  
at second requirement, an example of server-side controlling:  
yes, I have a headless instance of the game as a game server that running with Nakama.  
currently, players should submit leaderboard records or storage collections from their client-side game. then I think hackers can cheat. I have created a game server instance that processing the physics of the game by Unity Dots. I can not send the score to the client and submit it to the Nakama leaderboard. I want to add them directly from the server but I can’t link my c# game server and Nakama server. I should upload the player username and password to the game server and submit the leaderboard. it’s not the correct way. and players should not have permission to modify the leaderboard from the client.

---

<div class="post-metadata">

**Author:** ![novabyte](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/novabyte/32/1324_2.png) [@novabyte](https://forum.heroiclabs.com/u/novabyte)\
**Post date:** [December 20, 2020, 8:26pm UTC](https://forum.heroiclabs.com/t/create-unity-leaderboard/1215/6 "2020-12-20T20:26:23Z")

</div>

> yes, I have a headless instance of the game as a game server that running with Nakama.  
> currently, players should submit leaderboard records or storage collections from their client-side game. then I think hackers can cheat. I have created a game server instance that processing the physics of the game by Unity Dots. I can not send the score to the client and submit it to the Nakama leaderboard. I want to add them directly from the server but I can’t link my c# game server and Nakama server.

@hooman This is easy because the game server supports server to server (S2S) RPC functions. You’d have your headless game server instance execute an RPC and write the scores for your players. This is covered in the docs here:

[https://heroiclabs.com/docs/runtime-code-basics/#server-to-server](https://heroiclabs.com/docs/runtime-code-basics/#server-to-server)

In the Unity client you can make a server to server RPC function call with the method on the client object called `client.RpcAsync(string httpKey, string id, string payload = null)`.

---

<div class="post-metadata">

**Author:** ![hooman](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/hooman/32/420_2.png) [@hooman](https://forum.heroiclabs.com/u/hooman)\
**Post date:** [December 21, 2020, 8:10pm UTC](https://forum.heroiclabs.com/t/create-unity-leaderboard/1215/7 "2020-12-21T20:10:44Z")

</div>

ok, then I should create a Lua script to register the RPC hook and call RPC to access the server. where can I find an example? I want to verify the auth token at the server. or add a record and more…

---

<div class="post-metadata">

**Author:** ![novabyte](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/novabyte/32/1324_2.png) [@novabyte](https://forum.heroiclabs.com/u/novabyte)\
**Post date:** [December 21, 2020, 11:24pm UTC](https://forum.heroiclabs.com/t/create-unity-leaderboard/1215/8 "2020-12-21T23:24:10Z")

</div>

@hooman Have you had a look at the docs and tried to write any runtime code?

- [https://heroiclabs.com/docs/runtime-code-basics/](https://heroiclabs.com/docs/runtime-code-basics/)
- [https://heroiclabs.com/docs/runtime-code-function-reference/#leaderboards](https://heroiclabs.com/docs/runtime-code-function-reference/#leaderboards)

---

<div class="post-metadata">

**Author:** ![hooman](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/hooman/32/420_2.png) [@hooman](https://forum.heroiclabs.com/u/hooman)\
**Post date:** [December 22, 2020, 10:12am UTC](https://forum.heroiclabs.com/t/create-unity-leaderboard/1215/9 "2020-12-22T10:12:05Z")

</div>

yes, I’ve seen documents but I’m searching for a way without Lua or go languages.  
thank you, I will start learning Lua next month.

---

<div class="post-metadata">

**Author:** ![novabyte](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/novabyte/32/1324_2.png) [@novabyte](https://forum.heroiclabs.com/u/novabyte)\
**Post date:** [December 22, 2020, 1:38pm UTC](https://forum.heroiclabs.com/t/create-unity-leaderboard/1215/10 "2020-12-22T13:38:22Z")

</div>

@hooman We will also have JavaScript engine support in the game server in our next release in January. You should keep an eye out for that release in case you’re more comfortable with JavaScript/TypeScript development.

In the meantime you could just pass the session token for each player and store it server-side within your headless instance wherever you maintain the list of connected players. Then use the session token with each player to just send the leaderboard writes with the standard `client` object.

[https://heroiclabs.com/docs/gameplay-leaderboards/#submit-a-score](https://heroiclabs.com/docs/gameplay-leaderboards/#submit-a-score)

Hope this helps.
