- Home /
Question by
rabirland · Oct 25, 2017 at 03:06 PM ·
networkingrpccommand
Unet [command] doesn't get called at all.
I have an object:
Door. ----NetworkIdentity(only server: false, local client auth: false) ----DoorScript
DoorScript.cs:
[Command]
public void CmdOpenDoor()
{
Debug.Log("RECIEVED");
if (!isAnimating)
{
Debug.Log("OPENING");
}
}
Character ----NetworkIdentity(onlyserver:false; local client auth: true) ----CharacterControl
CharacterControl:
void Update ()
{
if (isLocalPlayer)
{
[...]
// DOOR TEST
RaycastHit hit;
if (Physics.Raycast(cameraController.transform.position, cameraController.transform.forward, out hit, Config.interactScanDistance))
{
DoorScript doorScr = hit.collider.GetComponentInParent<DoorScript>();
if (doorScr != null)
{
doorFound = true;
if (Input.GetKeyDown(KeyCode.E))
{
doorScr.CmdOpenDoor();
}
}
}
}
}
Both script is derived from NetworkBehaviour
If I run a "LAN HOST" I can open the door from the local client, but when I connect with another (non-local) client, I can't open the door, the CmdOpenDoor() doesn't get called at all.
Comment