BUG PhotonView has no method marked with the [PunRPC](C#) property! Args: Int32

everything worked well for some time
anyone has any solution how to fix it and how is photonView
spat out the error?
private void OnTriggerEnter(Collider other)
    {

        if (other.gameObject.GetComponent<Zdrowie>() != null)
        {
            
            if (!Network.IsOffline())
            {
                if (other.gameObject.GetComponent<PhotonView>() != null)
                {
                    other.gameObject.GetComponent<PhotonView>().RPC("RPC_Obrarzenia", RpcTarget.All, Damage);
                }
            }
            else
            {
                other.gameObject.GetComponent<Zdrowie>().RPC_Obrarzenia(Damage);
            }
        }
        if (!other.isTrigger)
        {
            Network.Destroy(gameObject, true);
        }
    }
public class Zdrowie : MonoBehaviourPun,IPunObservable {
     //~100 code line
    [PunRPC]
    public void RPC_Obrarzenia(int value)
    {
        zdrowie -= value;
    }
}

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @Nori_SC,

    Thank you for choosing Photon!

    Make sure Zdrowie component is on the same GameObject as the PhotonView.
  • Nori_SC
    Nori_SC
    edited August 2019
    @JohnTube
    is on enemy GameObject and spawn at run time
    but the script checks if it is assigned to an object

    I don't know why this is because I completely don't understand it
  • never mind fixed it
    spawner required a little delay in the start function