PhotonView with ID 0 has no method marked with the [PunRPC] error

Hello everyone,


I'm using v1 of PUN on unity just a heads up.

I've spent hours trying to figure out what's wrong here and I've given up so looking to see if anyone here can help?


PhotonView with ID 0 has no method "Squirt" marked with the [PunRPC](C#) or @PunRPC(JS) property! Args: 


I have a water gun in game and when the water spray particle is created I wanted all the players to see it.


When a button is pressed, SquirtSend is called.


Here's my code:

using System;
using System.Collections.Generic;
using Photon.Chat;
using UnityEngine;
using System.Collections;
using AC;
using UnityEngine.UI;


public class SquirtDrencherMultiplayer : MonoBehaviour {


[SerializeField] private GameObject spray;
 private GameObject player;
private PhotonView photonView;
	 
	
	// Use this for initialization
	[PunRPC]
	public void Squirt()
	{
	player = GameObject. Find("FuseModel2");
		PhotonNetwork.Instantiate (spray.name, player.transform.position, player.transform.rotation, 0, null);
		Debug.Log("hello");
	
	
}




	[PunRPC]
	public void SquirtSend () {
		 PhotonView photonView = PhotonView.Get(this);
		photonView.RPC("Squirt", PhotonTargets.All);
	}
	
}


I do have the script on the same game object as the PhotonView so I am lost.

I'm completely stuck on what to do.

Thank you 

😊



Comments

  • PUN Classic (v1.xyz) is really really old and no longer supported as such.

    The ViewID should never be 0, as far as I can say. SquirtSend should not be an RPC (it's not something you want called via the network)...