DestroyRpc
How do I use Destroy Rpc
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
34 | this.photonView.RPC("DestroyRpc", PhotonTargets.AllBuffered); | 1 |
39 | public IEnumerator DestroyRpc() | 2 |
File name: OnClickDestroy.cs
Copy
26 public void OnClick()
27 {
28 if (!DestroyByRpc)
29 {
30 PhotonNetwork.Destroy(this.gameObject);
31 }
32 else
33 {
34 this.photonView.RPC("DestroyRpc", PhotonTargets.AllBuffered);
35 }
36 }
File name: OnClickDestroy.cs
Copy
39 public IEnumerator DestroyRpc()
40 {
41 GameObject.Destroy(this.gameObject);
42 yield return 0; // if you allow 1 frame to pass, the object's OnDestroy() method gets called and cleans up references.
43 PhotonNetwork.UnAllocateViewID(this.photonView.viewID);
44 }
DestroyRpc 137 lượt xem
Gõ tìm kiếm nhanh...