RPC method not found on object with PhotonView
Options
I am having trouble with this code:
private void OnTriggerEnter(Collider other)
{
if (other.transform.name == "Finish")
{
GameObject.Find("Win").transform.GetChild(0).gameObject.SetActive(true);
GameObject.Find("Win").transform.GetChild(1).gameObject.SetActive(true);
photonView.RPC("sendLoss", RpcTarget.Others);
Destroy(this);
}
}
[PunRPC]
void sendLoss()
{
GameObject.Find("Loose").transform.GetChild(0).gameObject.SetActive(true);
GameObject.Find("Loose").transform.GetChild(1).gameObject.SetActive(true);
Destroy(this);
}
Making this error appear:
RPC method 'sendLoss()' not found on object with PhotonView 1001. Implement as non-static. Apply [PunRPC]. Components on children are not found. Return type must be void or IEnumerator (if you enable RunRpcCoroutines). RPCs are a one-way message.
UnityEngine.Debug:LogErrorFormat(Object, String, Object[])
Photon.Pun.PhotonNetwork:ExecuteRpc(Hashtable, Player) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:627)
Photon.Pun.PhotonNetwork:OnEvent(EventData) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:2160)
Photon.Realtime.LoadBalancingClient:OnEvent(EventData) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:3253)
ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(StreamBuffer) (at /Dev/Work/photon-dotnet-sdk/PhotonDotNet/PeerBase.cs:749)
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands() (at /Dev/Work/photon-dotnet-sdk/PhotonDotNet/EnetPeer.cs:552)
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands() (at /Dev/Work/photon-dotnet-sdk/PhotonDotNet/PhotonPeer.cs:1829)
Photon.Pun.PhotonHandler:Dispatch() (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:223)
Photon.Pun.PhotonHandler:FixedUpdate() (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:149)
Please help me, thank you
private void OnTriggerEnter(Collider other)
{
if (other.transform.name == "Finish")
{
GameObject.Find("Win").transform.GetChild(0).gameObject.SetActive(true);
GameObject.Find("Win").transform.GetChild(1).gameObject.SetActive(true);
photonView.RPC("sendLoss", RpcTarget.Others);
Destroy(this);
}
}
[PunRPC]
void sendLoss()
{
GameObject.Find("Loose").transform.GetChild(0).gameObject.SetActive(true);
GameObject.Find("Loose").transform.GetChild(1).gameObject.SetActive(true);
Destroy(this);
}
Making this error appear:
RPC method 'sendLoss()' not found on object with PhotonView 1001. Implement as non-static. Apply [PunRPC]. Components on children are not found. Return type must be void or IEnumerator (if you enable RunRpcCoroutines). RPCs are a one-way message.
UnityEngine.Debug:LogErrorFormat(Object, String, Object[])
Photon.Pun.PhotonNetwork:ExecuteRpc(Hashtable, Player) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:627)
Photon.Pun.PhotonNetwork:OnEvent(EventData) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:2160)
Photon.Realtime.LoadBalancingClient:OnEvent(EventData) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:3253)
ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(StreamBuffer) (at /Dev/Work/photon-dotnet-sdk/PhotonDotNet/PeerBase.cs:749)
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands() (at /Dev/Work/photon-dotnet-sdk/PhotonDotNet/EnetPeer.cs:552)
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands() (at /Dev/Work/photon-dotnet-sdk/PhotonDotNet/PhotonPeer.cs:1829)
Photon.Pun.PhotonHandler:Dispatch() (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:223)
Photon.Pun.PhotonHandler:FixedUpdate() (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:149)
Please help me, thank you
0