RPC call parameter limit

The whole answer can be found below.

Please note: 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! And we offer you support through 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 call parameter limit

SpicyBoi
2022-03-24 07:48:02

How many parameters can be hold in a method to be called by PhotonView.RPC? I have a relatively simple data file update with 12 parameters. but i keep getting the error

RPC method 'updateEventLog' found on object with PhotonView 12 but has wrong parameters. Implement as 'updateEventLog(String, Single, String, String, String, Int32, String, Int32, Int32, Int32, Int32, Int32)'. PhotonMessageInfo is optional as final parameter.

UnityEngine.Debug:LogErrorFormat(Object, String, Object[])

Photon.Pun.PhotonNetwork:ExecuteRpc(Hashtable, Player) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:630)

Photon.Pun.PhotonNetwork:OnEvent(EventData) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:2158)

Photon.Realtime.LoadBalancingClient:OnEvent(EventData) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:3142)

ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(StreamBuffer)

ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()

ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()

Photon.Pun.PhotonHandler:Dispatch() (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:208)

Photon.Pun.PhotonHandler:FixedUpdate() (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:142)

I know that the error kinda explain what to fix but i can't really change some of the variable type as some of them are float. Also, the recommended implementation has wrong entries as my method are originally

public void updateEventLog(string _event, float _timestamp, string _name, string _alert, string _proximitySpawn, int _Waypoint, string _spamLevel, float _coordinatesX, float _coordinatesY, float _coordinatesZ, float _duration, int _totalInstance)

Comments

Tobias
2022-03-24 16:25:24

You defined the RPC method with floats but seem to be sending integers. This won't match and there is no casting / conversion for this. Make sure the types you send match those that your RPC method expects.

Back to top