Using Unity 5s New Networking For Just Commands/RPCs

Hello. The game I am working on is multiplayer, but does not require spawning in player objects, player movement, or really anything besides just simple communication.

In previous versions of Unity, this was simple because it could be done by using RPCs and turning off the State Synchronization feature of the NetworkView component. It seems much more complicated to do this in Unity 5.

Is there an easy way to do this in Unity 5? Without having to create GameObjects for each player? Or will I need to create a GameObject for every player connected even if I’m not using it?



This would depend on what type of game you’re making, but I’m assuming you need some method for your players to submit requests to servers? The below information is using Unity5.1 but there have been some networking changes in Unity5.2 that may provide other options for you.

In UNET a player would submit requests to a server using [Command]. The problem with [Command] is it can only be called on a player prefab, in UNET’s case whatever GameObject spawned via the manager that evaluates to true when using isLocalPlayer().

You will still need these GameObjects in order for players to submit requests. From there you can have whatever scripts that a player interracts with call the GameObject to submit the [Command].

From what i know the client code only needs to know of the existence and the signature of the [Command] methods. You could just add them in as dummies with no functionality to make the server authoritative.