All PhotonView will recieve the RPC ?

Options
Hi everybody !

I would like to know like I said in the title if all they object recieve the rpc from player ?

To save message /s , I use my own system to send movement via rpc to other player

And in my room , I have some other object with photonview like a chest , or monter

So when a player move , RPC is send to all photonview no ?

There is a way to send some rpc only to player and not to object with photonview ?

Thanks for reading me and have a good day!

Comments

  • redskry
    Options
    up for help please ! :p
  • Hi @redskry,

    no, RPCs are always send to objects, not to players directly. If you want to send messages to certain players, you should take a loot at the RaiseEvent function mentioned in the RPCs and RaiseEvent Guide. RaiseEvent doesn't require a PhotonView component, neither for sending nor for receiving.

    So when a player move , RPC is send to all photonview no ?


    By default the RPC is sent to all clients to the same object. So when you send a RPC from object A it is received on object A on all clients. Object B won't receive anything for example.
  • redskry
    Options
    I dont understand raiseevent unfortunatly...
    He 's not possible To create photon group to send rpc only to they players ?

    Thanks for your help !
  • I think it's not possible with RPCs as you might run out of synchronization somehow.

    Using RaiseEvent the event invoking function looks like this.
    RaiseEventOptions options = new RaiseEventOptions
    {
        // Only use one of these at the same time, they have different priorities and will overwrite each other
        InterestGroup = 0, // Forwards this event to all clients subscribed to a certain group (0 is default)
        Receivers = ReceiverGroup.All, // Forwards this event to everybody in the room (can be set to Others or MasterClient as well)
        TargetActors = new int[] { 1, 2, 3 } // Forwards this event to certain clients (their IDs are used here)
    };
    PhotonNetwork.RaiseEvent(evCode, null, true, options);
    Make sure to register an OnEvent handler on PhotonNetwork.OnEventCall which actually handles the incoming event.
  • redskry
    Options
    Oh thanks ! I understand this ! But where is the fonction to call in this code ? And what is the difference with rpc ?

    Sorry for my bad understanding.. ^^'
  • The difference to RPCs is that it doesn't require an attached PhotonView component to work, so RaiseEvent is independent of PhotonView but you have to register a delegate to handle custom RaiseEvent calls. Please take a look at the RPCs and RaiseEvent doc page. It has a few examples for both options and also describes the differences between both of them. It has also tells you how to handle custom RaiseEvent calls.