playMaker

Author Topic: PhotonViewGetID - How to find GameObject by this ID?  (Read 14323 times)

ermak

  • Junior Playmaker
  • **
  • Posts: 60
    • AL Games
PhotonViewGetID - How to find GameObject by this ID?
« on: January 19, 2015, 08:21:16 AM »
Hi,

"GameObject" type can't be send over Photon network. "Network Sync" checkbox is inactive in "Variables" panel. Only: int, float, string... types can be send over network. OK

I trying with "PhotonViewGetID"
https://hutonggames.fogbugz.com/default.asp?W917
on "Master client" to get "PhotonView ID"... and i can send this ID as
Int or String to "others". But how after this on "Not Master client"
i can FIND this object by PhotonView ID and save to GameObject variable?

And in general what is the purpose of "PhotonViewGetID" action if there is
no "Photon Find" action?

600

  • Beta Group
  • Hero Member
  • *
  • Posts: 715
    • Flashing Lights
Re: PhotonViewGetID - How to find GameObject by this ID?
« Reply #1 on: January 19, 2015, 08:45:18 AM »
Hi,
I do this by looping through Player Count and compare their IDs with received one.
Maybe there are better solutions, but this works.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: PhotonViewGetID - How to find GameObject by this ID?
« Reply #2 on: January 19, 2015, 01:15:59 PM »
Hi,

 I have this in my drawer. An action that get a gameobject by id. Please bump me early february, I'll share it.

This is useful to send an rpc and reference a gameobject. it works really well.


 Bye,

 Jena

ermak

  • Junior Playmaker
  • **
  • Posts: 60
    • AL Games
Re: PhotonViewGetID - How to find GameObject by this ID?
« Reply #3 on: February 14, 2015, 02:01:59 PM »
Please bump me early february, I'll share it

I bump this topic by request of jeanfabre.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: PhotonViewGetID - How to find GameObject by this ID?
« Reply #4 on: February 16, 2015, 03:05:22 AM »
Hi,

 Please find the action in this package

 It will be shipped with the next build of the PlayMaker Photon package.

 Bye,

 Jean

Numster

  • Playmaker Newbie
  • *
  • Posts: 9
Re: PhotonViewGetID - How to find GameObject by this ID?
« Reply #5 on: October 30, 2019, 01:14:50 PM »
This action works like a charm for PUN 1, but does not for the new PUN 2...

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: PhotonViewGetID - How to find GameObject by this ID?
« Reply #6 on: November 01, 2019, 04:07:17 AM »
Hi,

Can you detail what doesn't work? the action simply return the viewId of a gameobject, nothing more, so I am not sure what doesn't work for you.

can you also compare the viewId shown in the photonView of the gameobject and check if it matches or not. For me it matches.



Bye,

 Jean

Numster

  • Playmaker Newbie
  • *
  • Posts: 9
Re: PhotonViewGetID - How to find GameObject by this ID?
« Reply #7 on: November 02, 2019, 04:37:28 AM »
Yes, this one works. But, we asked for find a gameobject by a viewID, not the view ID to a gameobject. With Pun Classic, we just had to use the "Find by view ID" action. In Pun 2, I haven't find the same action.

Personally, I used your "old" version of this action but with the new method to find a photon view and that's works for me.
(I shared it within this post)

Sorry for my bad english  :(

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: PhotonViewGetID - How to find GameObject by this ID?
« Reply #8 on: November 05, 2019, 01:53:23 AM »
Hi,

 ok, I see, it's because I still have a few actions to port from PUN Classic.

The findByViewID will be in the next release. It's already in the code base ( thanks for sharing the action).

Bye,

 Jean