Finding an item by its photonview id..

Well, Ive been trying to code that when the player picks an item, he sends the master client a request to destroy its gameObject from the scene.
Thats because the client is not its owner and I could do that just with photonnetwork.destroy..

Now, Ive made a method which picks the items photonviews id and sends it by an rpc to the master client.
The master client recieves the photonview id and from there... Im stuck, I can't figure out how to locate the gameObject by its photonview id.

How do I do that?
Is there a better way to do so?

Many thanks for anyone who helps. :)

Comments

  • To find a photon view by the id you can use PhotonView.Find(x); (x is the id, an integer). That returns the value of the photon view. To find the game object just add a .gameObject after (x)
  • Many thanks, I used that :)
  • Thanks so much :smiley: Do you know that is this method optimal? I mean using "GameObject.Find()" is expansive operation for games. Is "PhotonView.Find(x)" also not good method to use? Do they work in similar ways?
Sign In or Register to comment.