- Home /
Photon Network : Match gameObjects between clients via RPC
Hi, in Photon Network, is there a way to match gameObject between two clients durant a RPC Call? Example, i have 10 mob objects instantiated by the Master client. The Master client is responsible for selecting a target object for each mob. When the target is chosen, I would like to send a RPC Call to every client so that each mob on every client pick the same target object.
In other word, i want to pass a parameters to my RPC Call to identify the same object that the master client has chosen on every client.
Thank you
Answer by tobiass · Feb 13, 2015 at 02:02 PM
This only works if the target is also a networked object with a PhotonView. Then you have 2 options:
You can simply send the PhotonView.viewID of the target in a RPC (as parameter). This is lean and the viewID is unique (in the room).
You can use the target's PhotonView to call an RPC "CongratulationsYouAreTheNewTarget". That calls the RPC on the target GameObject on all clients and the target can "message" all enemies that it's the new prey. It's kind of "inverted" and maybe a bit cruel (the target alerts the enemies of itself) but it works, too.