Files
UltimateFishing/Assets/Scripts/Assembly-CSharp/OnClickDestroy.cs
2026-02-21 16:45:37 +08:00

30 lines
524 B
C#

using System.Collections;
using Photon;
using UnityEngine;
[RequireComponent(typeof(PhotonView))]
public class OnClickDestroy : Photon.MonoBehaviour
{
public bool DestroyByRpc;
public void OnClick()
{
if (!DestroyByRpc)
{
PhotonNetwork.Destroy(base.gameObject);
}
else
{
base.photonView.RPC("DestroyRpc", PhotonTargets.AllBuffered);
}
}
[PunRPC]
public IEnumerator DestroyRpc()
{
Object.Destroy(base.gameObject);
yield return 0;
PhotonNetwork.UnAllocateViewID(base.photonView.viewID);
}
}