Suggestion for a further PUN update

Hello,
I want to suggest something for a further update. I would like to see a workaround for optional parameters or a similar system which allows me to use one RPC for different situations. The problem that I have is that I could pass all parameters in one RPC, but I don't need all in every situations and they waste traffic. For example for Game Modes. I need some parameters just for a specific Game Mode. And if the players play another Game Mode, they don't need some parameters. I could also create 20 RPC's for different situations, but that doesn't make much sense to be honest.

That's why I would like to see a solution for kind of optional parameters which don't have to be included and if they are not passed in the RPC, they don't waste any traffic. It's mostly because of the traffic.

Comments

  • Hi @Duck,

    You can achieve this using custom events.
    See RaiseEvent.
    So instead of PunRPC method parameters, use RaiseEvent custom data (payload) to pass required or optional data and handle this on the receiving end.

    Adding support for optional parameters to PunRPC is not worth it as it can easily add conflicts or confusion when trying to parse proper method on receiving end as this is based on reflection.
  • Hello @JohnTube
    Thank you for your reply. I know about RaiseEvents but I feel more comfortable with PunRPC methods.
    I totally understand the issues and problems with optional parameters.