- Home /
Photon enable/ disable object
How do I enable or disable an object over network?
I followed Quill18's fps tutorials if that helps?
I just want to enable and disable and object attached to the main camera go my fps controller.
Answer by yotam180 · Aug 29, 2014 at 01:24 PM
gameObject.SetActive(false);
Fix me if i'm wrong :)
I think I already tried that... And it didn't show on the other computers. But not sure.
Answer by dooly123 · Sep 17, 2017 at 01:06 PM
This comes from my photon enter exit script and took me a few months to figure out.
[PunRPC]
void RemoveBlock(int BlockToRemove, bool setActive)
{
PhotonView Disable = PhotonView.Find(BlockToRemove);
Disable.transform.gameObject.SetActive(setActive);
}
by using the pun rpc ran through a void.
void DisableChildObject(bool setActive)
{
GetComponent<PhotonView>().RPC("RemoveBlock", PhotonTargets.AllBuffered, Human.transform.gameObject.GetComponent<PhotonView>().viewID, setActive);
}
Your answer
Follow this Question
Related Questions
Find closest object with tag 1 Answer
Bullet Effect (RaycastAll Question) 1 Answer
Find children of object and store in an array 3 Answers
Remove first element of array 1 Answer
Find closest transform 1 Answer