API Improvement

Options
I have come upon something unexpected in my understanding of the PUN API. I have always assume that if a PhotonView.observed is pointing to component "A", RPC calls with that PhotonView will be routed to component "A" on the remote machine. Hence if I have two instants on "A" attached, I will just need two PhotonViews, observing each "A", and my RPC will be route to the appropriate instant. This will be very handy, because components can inherit from a base class which has RPC functions, and objects can be attached with multiple derived components.

However this doesn't seem to be the case. The observed property seems to be only use for synchronize valuables. Hence I got the "PhotonView with ID xxx has 2 methods YYY that takes..." error.

Am I right? Is there another way circumvent my problem? Will future version implement a "fix"?

Thanks
David

Comments

  • Tobias
    Options
    Hi David,
    Thanks for your feedback. We really appreciate you're suggesting features. Thanks.

    You are right. The observed component is just the one that's called to provide synchronization info.

    I do understand your case but I am not yet convinced that we should implement it.
    It's going to be annoying that you have to setup each script as observed, before it can receive RPCs, when you look at it the other way round. It's confusing, when nothing happens.
    Also, the PhotonView currently relates to a object and less to individual components.

    If you must target specific components, you could insert a parameter into your RPC to target a specific component. In the end, that's a sub-PhotonView system, more or less.
    You can skip the parameter, when you don't need it.

    What do you think?
  • Thanks for replying!

    My use case is fairly common, where the 2 (or more) MonoBehaviours on the object are derive from same base class and the RPC is in the base class. I can greatly reduce the complexity of the code by moving common RPC to the base class.

    I have implemented this already by modifying a small amount of Photon code. First if there is no observed component, everything behave as before. If there is observed component and then it a "Route RPC to Observed" is checked , then it search within the Observed only. If no matching found was found than continue searching in other components. I think that will introduce very little change to existing users.

    Thanks
    David