The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

RPC method not found on obeject?

Taco
2022-07-16 07:08:07

I am trying to add synchronization and visibility to the bullets my two players are shooting and for some reason, I am getting the error "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."

My code seems to be correct, I do not have a photonView script on my bullet prefab only the player so I am a bit confused as to why this is occuring.

My code:

// Update is called once per frame

void Update()

{

PlayerShoot();

PlayerMove();

}

void PlayerShoot()

{

if (Input.GetButton("Fire1") && coolingDown.coolingDown == false)

{

photonView.RPC("Shoot", RpcTarget.All, null);

//Shoot();

}

}

[PunRPC] void Shoot()

{

if(Time.time - lastShot < shootSpeed)

{

return;

}

lastShot = Time.time;

Rigidbody clone;

clone = Instantiate(projectile, lwattackPoint.position, transform.rotation * Quaternion.Euler (90f, 0f, 0f));

clone = Instantiate(projectile, rwattackPoint.position, transform.rotation * Quaternion.Euler (90f, 0f, 0f));

}

Comments

Tobias
2022-07-18 09:41:26

Check which object the photonView points at. It is maybe an object that doesn't have the Shoot method.

Back to top