RPC Not Working

Options
Hello, I am very new on Photon and try to build a FPS Game. But there is a RPC, wich is not working on any client.

   [PunRPC]
    private void Shoot(Transform startingTransform, float damage, float range)
    {
        var tmpo = GameObject.FindWithTag("debugInformationText");
        var t = tmpo.GetComponent<TextMeshProUGUI>();
        t.SetText("RPC Executed"); // I dont see this
        //Not Executing
       //Some other Code();
    }
    public void ShootCommand(Transform fpsCamera, float damage, float range)
    {
        //Executing without problems
        var tmpo = GameObject.FindWithTag("debugInformationText");
        var t = tmpo.GetComponent<TextMeshProUGUI>();
        t.SetText("RecivedShootCommand"); // I see this
        photonView.RPC("Shoot", RpcTarget.All, fpsCamera.transform, damage, range);
    }
So as I see in the Debug InformationText, The "ShootCOmmand" function is getting called, but the [PunRPC] Shoot function is not.

Thanks for your help
~BrainyXS

Comments

  • brainyxs
    Options
    [PunRPC]
    private void Shoot(Transform startingTransform, float damage, float range)
    {
    var tmpo = GameObject.FindWithTag("debugInformationText");
    var t = tmpo.GetComponent();
    t.SetText("RPC Executed");
    //Not Executing
    photonView.RPC("Shoot", RpcTarget.All, startingTransform, damage, range);
    particle.time = 0;
    particle.Play();
    RaycastHit hit;
    if (Physics.Raycast(startingTransform.position, startingTransform.forward, out hit, range))
    {
    Debug.Log(hit.transform.name);
    var target = hit.transform.GetComponent();
    if (target != null)
    {
    target.TakeDamage(damage);
    }
    }
    }
    public void ShootCommand(Transform fpsCamera, float damage, float range)
    {
    //Executing
    var tmpo = GameObject.FindWithTag("debugInformationText");
    var t = tmpo.GetComponent();
    t.SetText("RecivedShootCommand");
    photonView.RPC("Shoot", RpcTarget.All, fpsCamera.transform, damage, range);
    }

    Code in better format