Turn On/Off cars Light
Options
Hi everyone, I need help to understand something.
In my room, everyone instances their car, the car has lights attached to it. When I activate / deactivate the lights, this only works for the owner of the car.
I tried to make a PUNRPC call, where I get the viewID of the player. But I can't get the lights to come on.
Can anyone show me a way?
I thank.
My Code:
In my room, everyone instances their car, the car has lights attached to it. When I activate / deactivate the lights, this only works for the owner of the car.
I tried to make a PUNRPC call, where I get the viewID of the player. But I can't get the lights to come on.
Can anyone show me a way?
I thank.
My Code:
public void AccendiSpengifari() { if (FAD.isActiveAndEnabled) { FAD.gameObject.SetActive(false); FAS.gameObject.SetActive(false); FPD.gameObject.SetActive(false); FPS.gameObject.SetActive(false); MostraIFariAccesi(); } else { FAD.gameObject.SetActive(true); FAS.gameObject.SetActive(true); FPD.gameObject.SetActive(true); FPS.gameObject.SetActive(true); MostraIFariSpenti(); } } void MostraIFariAccesi() { photonView.RPC("AccendiFari", RpcTarget.All, photonView.ViewID); } [PunRPC] void AccendiFari(int playerViewID) { //Debug.Log(playerViewID.ToString()); GameObject zzzplayer = PhotonView.Find(playerViewID).gameObject; Debug.Log(zzzplayer.name + " Ha acceso i fari, player viewID: " + playerViewID); //zzzplayer.transform.FindChild(FindGameObjectsWithTag("CheckPoint").ToList(); //GameObject veicolo = zzzplayer.transform.Find("Veicolo").gameObject; //veicolo.SetActive(false); }
0