Hello I’m really confused about RPC. How to make the animation/command play on opening doors to all client? I have tried youtube tutorials, I only sync Masterclient to other users POV. But when other users open the door, it does not sync to Masterclient.
Need help…
void Update()
{
if (Input.GetKeyDown(KeyCode.F))
{
Pressed();
}
}
public void Pressed()
{
if (Physics.Raycast(PlayerCamera.transform.position, PlayerCamera.transform.forward, out doorhit, MaxDistance))
{
if (doorhit.transform.tag == "Door" && key1 == 1)
{
anim = doorhit.transform.GetComponent<Animator>(); //THIS IS THE CODE OPENING THE DOOR
audio1 = doorhit.transform.GetComponent<AudioSource>();
opened = !opened;
anim.SetBool("Opened", !opened);
audio1.PlayDelayed(openDelay);
}
}
}
}