Storing Player Stats on Server using UNET

Hello Unity Forum!

I am currently in the process of making a 2D, 100% UI driven game, that is single player as far as the gameplay is concerned. However, a big part of the game is seeing how you rank up against over players (basically leaderboards). I am at the point where I am ready to add the server, and I new that Unity had this new UNET thing that everyone seems to like.

I watched a bunch of videos, and browsed through multiple example projects. I saw the use of a NetworkManager to sync the transform of player prefabs in a scene across all clients. I saw NetworkManagers controlling individual animators on each of the clients. I saw lots of really impressive other stuff done easily using the new network components…

… but I did not see anything equivalent to Unity’s simple old RPCs, which I could just use to call a method with passed arguments on the server from the client, and vice versa.

Am I overlooking something obvious? I tried to use the old netoworking system, but it didn’t seem to work the same way (specifically, I could no longer use networkviews) and I later read that it had been depreciated to the point of being unusable.

Any advice or help with just sending simple C# data types between a server and client (both ways) would be much appreciated. Thank you very much for your time!

Data is now sent with syncvars or with Command and ClientRpc. Command sends to the server (host is both server and client), and ClientRpc sends back to the clients. If you’re just syncing a simple int or float, then syncvars should be enough. Take a look at this page of the manual for more details and examples. Or start with the first one if you didn’t read the manual yet.

Thank you very much for your very helpful response. I feel strongly after reading the script reference and manual on Commands and ClientRpc that they will give me most of the functionality I will need.

I have continued my research on UNET and I have a very related, more general question. The networking that I need is very slim. I don’t want a scene with a bunch synced PlayerPrefabs. I don’t want anything more than the passing of data. I don’t even really want my server to be related to Unity at all. Am I going about this the wrong way by using UNET?

I am getting the sense that UNET is for multiplayer games that have players with transforms, and lobbies, matchmaking, etc. I see a lot of tutorials, examples, and documentation on how to do all this stuff, but meanwhile I can’t figure out how to even get the number of clients currently connected to my server.

Is there a simpler alternative that I am overlooking that would be more well suited for things like leaderboards and stat tracking? Thanks again for all your help.

Just in case others are curious, I ended up using a completely different approach.

The above link turned out to be a much more slim and simple way to achieve what I was looking for.