RPC method not found при стрельбе

подскажите пожалуйста ответом на мою ошибку

При стрельбе по другому игроку она выдает ошибку: "RPC method 'Shoot()' not found on object with PhotonView 2001. 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."

Я прикреплю скрипты здесь

Gun.cs

private void Shoot()
{
    RaycastHit hit;
    if(Physics.Raycast(CameraHead.position, CameraHead.forward, out hit, distance))
    {
        if(hit.collider.gameObject.tag == "Player")
        {
            Debug.Log("Попал в " + hit.collider.gameObject.GetPhotonView().Owner.NickName);
            PhotonNetwork.Instantiate(playerHitImpact.name, hit.normal, Quaternion.identity);

            hit.collider.gameObject.GetPhotonView().RPC("DealDamage", RpcTarget.All, photonView.Owner.NickName);
        }
        else
        {
            GameObject bulletImpactObject = Instantiate(bulletImpact, hit.point + (hit.normal * .002f), Quaternion.LookRotation(hit.normal, Vector3.up));
            Destroy(bulletImpactObject, lifeTimeDecal);
        }

        WeaponOverHeating();
    }

    shotCounter = fireRate;
}

[PunRPC]
public void DealDamage(string damager)
{
    Debug.Log("I've been hit by" + damager);
}

Моя структура игрока

введите сюда описание изображения

Скрипт Gun лежит на объектах Gun1 Gun2 Gun3

Я прошу вашей помощи, потому что я не до конца понимаю, почему RPC не работает

Спасибо вам всем за вашу помощь.


Ответы (0 шт):