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.

How do I make a list of players in the current room with nicknames?

Seth01Master
2022-04-28 13:36:58

Hi!

I would like to make a system where you can vote kick people out of a lobby if they are hacking, cheating, ect.

But, I cannot find a way to get the nicknames of all players in the current room! I tried using

but it keeps giving me an error and underlines "Player" in red with the text:

The type or namespace name 'Player' could not be found.

How am I supposed to define 'Player', or how should I go about making a player list?

Thanks!

Comments

Tobias
2022-04-29 09:30:24

You are not supposed to define it. It should be defined.

Is the IDE also complaining about PhotonNetwork being unknown?

It could be an issue with the Visual Studio package of Unity, which is known to sometimes generate incomplete project files (for the IDE). Check the Package Manager if there is an update. Generate the files again (there is a button somewhere but I don't recall where).

That usually helps.

Which version if Unity do you use? And which PUN version?

Seth01Master
2022-04-29 14:35:22

Sorry for not responding sooner!

I actually solved the problem by adding:

The rest of my code seemed to work fine without it (even though it used "using Photon.PUN"), but adding it seemed to solve the problem.

Thanks!

Back to top