When I run my Unity server in host mode, the object spawns on the client and uses the CmdRequestUpdate() command, which then should call a ClientRPC and a TargetRPC. The client will receive the TargetRPC call, however it never receives the ClientRPC call. I’m not sure if this is an issue or not but I’m curious if anyone knows what’s going on here.
Reproducer
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
public class PlayerAttributeManager : NetworkBehaviour
{
[Server]
public override void OnStartServer()
{
Debug.Log("server attributes started.");
}
[Client]
public override void OnStartClient()
{
Debug.Log("Client attributes started.");
CmdRequestUpdate();
}
[Command]
public void CmdRequestUpdate()
{
Debug.Log("Server got request for update.");
RpcGetYourUpdate();
Debug.Log("RPC sent");
TargetGetYourUpdate(this.connectionToClient);
Debug.Log("Target RPC sent");
}
[ClientRpc]
void RpcGetYourUpdate()
{
Debug.Log("Received update.");
}
[TargetRpc]
void TargetGetYourUpdate(NetworkConnection conn)
{
Debug.Log("Target received update.");
}
}
Output with Unity 5.5.0f3
server attributes started.
Client attributes started.
Server got request for update.
RPC sent.
Target RPC sent
Target received update.