This has been requested a lot, ever since UNET.
For example:
class Inventory : NetworkBehaviour
{
// drop item at slot
[Command]
void DropItem(int slot) { ... }
// local client may request to drop
void Update()
{
if (isLocalPlayer && clicked) DropItem(4);
}
// server may want to call the code too
[Server]
void PunishPlayer()
{
// THIS ERRORS because commands can't be called on server-only
for (i = 0 to count)
DropItem(i);
}
...
}
This has been requested a lot, ever since UNET.
For example: