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
Documentation

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.

Read More on
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.

Get PhotonView through Player object / Get all PhotonViews in current room

StrikeAgainst
2022-01-13 12:50:14

I'm having a case where I need to acess each player's photon-instantiated gameobject in a room in short intervals. I figured I could do this via

and then grab each player's individual PhotonView Component, until I figured that the Player object doesn't seem to support any functionality to do so. Am I missing something or is this just impossible?

Alternatively I'd also take some functionality to get all PhotonViews in the current room, but apart from

which could kill my performance, there seems to be none as well. Does someone have an idea how to do so in a reasonably performant way?

Comments

DhoodPro
2022-01-14 01:40:29

I would propose creating a list to hold the players in the room then adding to the list as a player enters through an RPC. Then run your intervals locally (preferably for performance), or through a stream, by just searching through the list of players.

StrikeAgainst
2022-01-20 01:27:39

That's rather cumbersome... but I guess there ain't another way then.

JohnTube
2022-01-21 06:05:13

Hi @StrikeAgainst,

The idea is that PhotonView ViewID is generated from the Player's ActorNr.

More details here.

Back to top