Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by oliver-jones · May 25, 2012 at 10:40 PM · networknameplayersprofile

Network - Best Way To View Players In Game?

Hello,

Just wondering whats the best approach to viewing all the players currently in my networked game? For example, if I press the 's' key and a table comes up showing all the players currently in game?

Right now the players are defined by 'Network.player', which just shows an int, so I'm thinking before the player joins, he/she types a player name into a GUI.Textfield, which is then passed on to the game, and held into an array that the 'Network.player' can be used as an index?

I'm hoping, at a later stage, to hold a score too, which will be displayed in the table next to the players name.

Could this work, is there a better way to do this? Could you show me some examples?

Thanks all!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by whydoidoit · May 25, 2012 at 10:43 PM

Firstly you can use the code in my second example on the post I'm linking to in order to hold variables indexed off Network.player without worrying about reference counting and deleting them afterwards (avoids memory leaks etc). http://answers.unity3d.com/questions/256458/adding-functions-variables-to-runtime-classes.html

That code will let you hold a name, a score and anything else you want.

If you don't want to slow down your player you could just assign them a random name (made from common name parts) and give them the ability to overwrite it.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image oliver-jones · May 25, 2012 at 10:46 PM 0
Share

Ah $$anonymous$$ike saves the day once again! I like the idea of having a common name generator, good idea! Thanks again!

avatar image whydoidoit · May 25, 2012 at 10:47 PM 0
Share

Oh and I tend to add the name of the player floating over their head the first time you see them, fade it out after a couple of seconds. Note that's see them, i.e. in view for more than 0.5 seconds on the particular players view.

You can also popup "toast" in a corner of the screen when a player joins or leaves - that's quite nice. Also cool for things like "Bill just blasted Bobby" etc

Gives them all personality even if you can't see them if you do funny stuff like - Bill just ran into a wall! - Well I find it funny ;)

avatar image whydoidoit · May 25, 2012 at 10:52 PM 1
Share

Hey your networking questions are doing my $$anonymous$$arma no end of good :)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

object naming via network 0 Answers

MMO Player Hosting 0 Answers

UNet, how to create Internet game (like via PhotonNetwork) 0 Answers

Displaying players name above in multiplayer 1 Answer

A name For the Character Please Help 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges