Get Photon View Id of gameobject.

Hello guys, i am converting my Unity multiplayer game into Photon Multiplayer and i am stuck in one place where i have to get the PhotonViewID of a game object. In unity networking you can get the view id like this.


but i do not know how to get the photon View id?

any help will be appreciative

Perhaps you’ve forgotten to prefix MonoBehavior with Photon.MonoBehavior. That inheritance should add the PhotonView; property.

So, if you are still following this topic, I found an answer:

so, before any “voids” write : PhotonView thisPhotonView
then in Start() write : thisPhotonView = GetComponent()
then you can just write : thisPhotonView.viewID

So I know that this topic’s extremely old but for anyone reading about this in further years here’s the answer for Photon Pun 2: Change MonoBehaivour To MonoBehaviourPun To add photonView into your code. this is the automatic way of getting this game objects Photon View Component. then simply just get photonView.ViewID; Hope this helps someone!