The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

How to get a client ID?

2017-08-04 01:43:21

A very simple question: I have a script on an instantiated game object and I want something like this:

public int GameObjectOwnerID;

void start()
GameObjectOwnerID =;

The player id is the same id you get if you receive an event by PhotonNetwork.RaiseEvent. If you receive the event you get the senderid which you can use for conditions etc... Thank you in advance!


[Deleted User]
2017-08-07 08:10:11

Hi @lennart862,

if this game object gets instantiated through PhotonNetwork.Instantiate, it has an attached PhotonView component. Using this you can get the ID you are looking for: GetComponent().ownerId

PhotonNetwork.player.ID only returns the ID of the local client, so using this would end in an unwanted behaviour.

Back to top